Wednesday, July 27, 2016

Yes, when you specify that the text file should be encoded in UTF-8, the CRT implicitly assumes that you'll be writing Unicode text to the file. Not doing so doesn't make sense, you wouldn't need UTF-8. This will work proper:
wchar_t* x = L"Fool";
FILE* outFile = fopen( "Serialize.txt", "w+,ccs=UTF-8");
fwrite(x, wcslen(x) * sizeof(wchar_t), 1, outFile);
fclose(outFile);
Or:
char* x = "Fool";
FILE* outFile = fopen( "Serialize.txt", "w+,ccs=UTF-8");
fwprintf(outFile, L"%hs", x);
fclose(outFile);

***

http://stackoverflow.com/questions/3973582/how-do-i-write-a-utf-8-encoded-string-to-a-file-in-windows-in-c




http://www.cplusplus.com/forum/general/7935/


wchar_t name[] = "акмал";

FILE * pFile;
pFile = fopen ("myfile.txt","w");
 
fwrite(name, sizeof(wchar_t), wclen(name), pFile);
fclose(pFile);


A couple of observations.

wchar_t name[] = "акмал";
should be
wchar_t name[] = L"акмал";
It should have failed to compile.

As you'll never encounter '\n', you should open the file in binary mode.
FILE *pFile = fopen("myfile.txt","bw");

Wednesday, July 20, 2016

KOMUNIKATOR...


Status: Online

GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}