将数据写入文件的程序
1 #include<fstream>
2 using namespace std;
3
4 int a(void)
5 {
6 return 10;
7 }
8 int main(void)
9 {
10 ofstream ofs;
11 char filename[16]=".\\a.txt";
12 ofs.open(filename,ofstream::app);
13 ofs<<a();
14 ofs.close();
15 ofs.clear();
16 return 0;
17 }
.\\表示程序当前文件夹
..\\表示上一文件夹
也是转的,但出处不详
浙公网安备 33010602011771号