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
Post a Comment