String strFile="c: \ \ utf-8 test11. TXT".
//step1: creating utf-8 files
The FILE * fp=fopen (strFile c_str (), "w, CCS=utf-8");//the new file
Assert (fp!=NULL);
The fclose (fp);
//step2: written content
STD: : fstream fout.
Fout. Open (strFile. C_str (), STD: : ios_base: : _Nocreate | STD: : ios_base: : out);//by default, speaking, reading and writing, normal file
Fout & lt; <"China";
Fout. Close ();
//step3: file save as, coding format for: ANSI, why
CodePudding user response:
Google "fstream utf-8"http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/