Halcom 发表于 2022-3-19 23:04:33

C++写入txt

C++写入txt
#include <fstream>
//std::string filename0 = "C:\\WitiaiCvCodes\\testimages\\example.txt"; // 指定文件名
        //std::ofstream outfile(filename0); // 创建ofstream对象,并打开文件
        //std::string textToWrite = "Hello, World!\n这是第二行文本。"; // 准备要写入文件的字符串
        //outfile << textToWrite; // 将字符串写入文件
        //outfile.close(); // 关闭文件



参考:
【1】https://www.cnblogs.com/lzq116/p/10899839.html
【2】https://jingyan.baidu.com/article/8275fc865363d846a03cf619.html





页: [1]
查看完整版本: C++写入txt