C++中将数据写入到文件中

C++中将数据写入到文件中

#include<iostream>
#include<fstream>

using namespace std;

int main(int argc,char **argv){
    int myid=1,procnum=64;
    ofstream out("./log",ios::app);
    out<<"myid:"<<myid<<endl;
    out<<"procnum:"<<procnum<<endl;
    out.close();
    return 0;
}

log文件中的内容:

myid:1
procnum:64

猜你喜欢

转载自blog.csdn.net/k5722166/article/details/81232201