【CC++】文件操作

xiaoxiao2025-09-03  11

Backto C/C++ Index

引入头文件

#include <fstream>

然后 Read 用 ifstream, Write 用 ofstream

ifstream infile; ofstream outfile; // common operarions file.open("file_path.text", MODE); // do your bussiness here file.flush(); // if write file.close();

更简介高级的方式,还是使用封装好的库吧.比如

OpenCV 读写 YAML 文件

Ref

C++中Txt文件读取和写入 : 知识点讲解,排版很乱c++对txt文件的读取与写入 : 例子可以, 直接copy过来改一下场景就可以用
转载请注明原文地址: https://www.6miu.com/read-5035651.html

最新回复(0)