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

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

#include
#include

using namespace std;

int main(int argc,char **argv){
    int myid=1,procnum=64;
    ofstream out("./log",ios::app);//app表示每次操作前均定位到文件末尾
    if(out.fail()){
        cout<<"error\n";
    }
    out<<"myid:"<

log文件中的内容:

myid:1
procnum:64

你可能感兴趣的:(C++)