File IO (txt file)
How do I read information from a certain line from a txt file in as a char, and then edit it.
This my code, but it doesn't work? Can someone please help as File IO is one of my weaker areas of C++..
Also can someone explain what the 100 after (buffer, is refering to?
int lines =;
cout << "Please Enter the line you would like to edit: ";
cin >> x;
cout << "Line " << x << " curently reads ";
ifstream afile (managerfile);
if(lines==x) cout << buffer;
else cout << "Line " << x << " does not exsist";
cout << "Replace with: ";
cin >> replacement;
ofstream bfile (managerfile, ios::app);
cout<<"Line Succesfully Edited";
There is LOTS of information on this topic on the FAQ board, and a comprehensive tutorial to this in the tutorials section of the main site.
But I've read through the tutorials about file io and search the net but cann't find any info on how to goto to specific line in a txt file and then edit it??