How to put/get INT to/from a WCHAR array ?
- by nimo
how can I put a INT type variable to a wchar array ?
Thanks
EDIT:
Sorry for the short question. Yes we can cast INT to a WCHAR array using WCHAR*, but when we are retrieving back the result (WCHAR[] to INT), I just realize that we need to read size of 2 from WCHAR array since INT is 4 BYTEs which is equal to 2 WCHARs.
WCHAR arData[20];
INT iVal = 0;
wmemcpy((WCHAR*)&iVal, arData, (sizeof(INT))/2);
Is this the safest way to retrieve back INT value from WCHAR array