How to write a unicode string to file

M

mimi

#include <fstream>
#include "stdio.h"

int main()
{
// std::wofstream strm2("test.txt");
// strm2 << L"ÎÒ°®±±¾©Ìì°²ÃÅ";

FILE *hFile = fopen("test.txt", "wb+");
wchar_t *buffer = L"ÎÒ°®±±¾©Ìì°²ÃÅ";
fwrite (buffer , sizeof(buffer[0]) , 7 , hFile );
fclose (hFile);

return 0;
}

The program works. But how could i use wofstream in STL to write a
unicode string to file? The code above which is commented does not
work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top