Hi,
I would like to open a file for writing several times. I used append which works, but every time I re-run the program the file grows. What I really want to do is only append after the first time the function has been called. So I tried doing like this.
Where nphases is growing every time the function is called in a loop so I know if it is the first time or not. However this didnt work. I hope I explain myself well enough =) Anybody know a good way to do this?Code:ofstream voxel; if (nphases == 0) { ofstream voxel (outname.c_str(), ios::out|ios::binary); } else { ofstream voxel (outname.c_str(), ios::out|ios::binary|ios::app); }