-----First example-----
1,firstguy,hispassword
2,nextguy, hispassword
------------------
i want to change numbers here and add a 10000 to front of them so it would read
100001,firstguy,hispassword
100002,nextguy, hispassword
-------- 2nd example -------
1, A_name, 4 , more data, etc
----------------------------------------------------------------
i want to change first and second numbers here and add a 10000 to front of them so it would read
100001, A_name, 100004, more data, etc
Note:
this is going to be on a large scale with hundreds of records to change to that kind of thing
here is my lame code that doesn't work. take a look at it if you can solve this problem that would be really cool.
thanks for looking
Code:#include <fstream> #include <iostream> using namespace std; int main() { ifstream infile; ofstream outfile; string mystring; infile.open("in.txt"); outfile.open("out.txt"); while(infile) { infile.getline(mystring); outfile.write("10000"); outfile.write(mystring); } outfile.close(); infile.close(); return 0; }



LinkBack URL
About LinkBacks



