writing utf16 record binary mode
i'm perplexing wstring record ofstream binary mode, nonetheless i cruise i'm doing something wrong. i've tried:
ofstream outfile("test.txt", std::ios::out | std::ios::binary);
wstring hello = l"hello";
outfile.write((char *) hello.c_str(), hello.length() * sizeof(wchar_t));
outfile.close();
opening test.txt instance firefox encoding set utf16 arrangement as:
hello
could anyone tell me since happens?
edit:
opening record conjuration editor i get:
ff fe 68 00 00 00 65 00 00 00 6c 00 00 00 6c 00 00 00 6f 00 00 00
looks i twin additional bytes between each impression reason?
Comments
Post a Comment