Appending a new line in a file(log file) in c++

前端 未结 3 2035
感情败类
感情败类 2021-01-17 07:37

I have a logging functionality and in this I have got log files. Now every time I run the program I want that previously written file should not get deleted and should be ap

3条回答
  •  不要未来只要你来
    2021-01-17 07:57

    maybe you need to open the file with the append option. like this:

    FILE * pFile;
    pFile = fopen ("myfile.txt","a");
    

    or this :

    fstream filestr;
    filestr.open ("test.txt", fstream::app)
    

提交回复
热议问题