I have a simple question... If I want to copy the Ctrl-Z (^Z) or ASCII 26 into a wchar_t buffer. How much size that I should allocate for the buffer? 1, 2, or 4 bytes?
regards,PHP Code:wchar_t CZ[1];
memset(CZ,0,1);
CZ[0] = 26;
:)
Printable View
I have a simple question... If I want to copy the Ctrl-Z (^Z) or ASCII 26 into a wchar_t buffer. How much size that I should allocate for the buffer? 1, 2, or 4 bytes?
regards,PHP Code:wchar_t CZ[1];
memset(CZ,0,1);
CZ[0] = 26;
:)
sizeof(wchar_t) = 2
hi! parksie, do you mean i should declare with size = 2? I sis try with size 1. ie
wchar_t CZ[1];
and it work too :rolleyes: why? I know 1 byte of char = 2byte of wchar_t. Am i right?
wchar_t CZ[1] is a bizarre thing to write because you might as well use wchar_t CZ. One wchar_t is 2 bytes, but one char is 1 byte.