- // use C to write into file
- FILE *pFile=fopen("1.txt","w");
- CString strTemp = "hello world!";
- fwrite(strTemp,1,strTemp.GetLength(),pFile);
- fflush(pFile);
- fclose(pFile);
- // use C++ to write into file
- ofstream ofs("2.txt");
- CString str = "Use C++.Hello World !";
- ofs.write(str,str.GetLength());
- ofs.flush();
- ofs.close();
- // use MFC to write into file
- CString str = "Use CFile,Hello World !";
- CFile file("3.txt",CFile::modeCreate | CFile::modeWrite);
- file.Write(str,str.GetLength());
- file.Flush();
- file.Close();
原文链接: https://www.cnblogs.com/liuweilinlin/archive/2012/07/19/2598713.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/55937
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!