c++ - How to open a new ofstream for 'iterated counter'.txt? -


i have following within while loop, works expected (it creates new ofstream , .txt files each line of defined ifstream) fills them garbage. i'm new language , can't seem figure out why. great.

ofstream lineoutfile;  string newfilename;  stringstream linefile; linefile << linect; linefile >> newfilename;  newfilename += ".txt";  lineoutfile.open(newfilename.c_str());  if(!lineoutfile) {     cerr << "can't open output file.\n"; }  lineoutfile << "the corrected 5' x 3' comple...." <<  ect...;  lineoutfile.close();  linect++; 


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -