Linux.com

wrong

Posted by: Anonymous Coward on February 12, 2006 06:13 AM
This:
<tt>char widechar = L'\0';
char* widestring = L"Hello, world!";</tt>
should have been
<tt>wchar_t widechar = L'\0';
wchar_t* widestring = L"Hello, world!";</tt>
Wide character support doesn't change the meaning of plain <tt>char</tt>. Also, note that on windows sizeof(wchar_t)==2 and on linux sizeof(wchar_t)==4, as dictated by the up-to-date Unicode spec. Saving it directly to a file might lead to incompatibilities -- but most often it's converted to utf-8 anyway.

#

Return to Programming with wide characters