visual c++ - overwriting in a .txt file -
visual c++ - overwriting in a .txt file -
i'm writing code visual c++. target writing double values in .txt file. problem i'm passing in cicle , everytime there's file overwrite , can see lastly value. (the values of marker1, marker2, marker3 alter in every cicle).
ofstream myfile; myfile.open("c:/mattia_progetto/linescannerrealtime/markers.txt"); myfile<<marker1[0]<<"\t"<<marker1[1]<<"\t"<<marker1[2]<<"\t"<<marker2[0]<<"\t"<<marker2[1]<<"\t"<<marker2[3]<<"\t"<<marker3[0]<<"\t"<<marker3[1]<<"\t"<<marker3[2]; myfile.close();
how can solve it?
pass ios::app
mode flag myfile.open()
append file instead of overwriting contents.
see: http://en.cppreference.com/w/cpp/io/basic_ofstream/open
visual-c++
Comments
Post a Comment