xcode std::wcout with wchar_t or std::wstring!
i had a sinilar problem but with wostream/wofstream. Googled it and this was the anser:
tc_ofstream ofs;if (sizeof(TCHAR) == sizeof(wchar_t)){ //codecvt_utf16<TCHAR> utf16; cannot make use of non-dynamic value locale loc ( locale::classic() ,new codecvt_utf16<TCHAR> ); ofs.imbue( loc ); ofs.open( _T(".\\test.txt") ,tc_ios::binary ); TCHAR BOM = 0xFEFF; ofs << BOM; ofs << _T("UNICODE") << endl;}else{ ofs.open( _T(".\\test.txt") ,tc_ios::binary ); ofs << _T("NON-UNICODE") << endl;}
If you use wxWidgets, wxString handles this for you automagically, using wxConvCurrent.