Sep 3, 2009

Read the last line of a text file in C/C++

C code

Alternately getline method can be used in C++.
Here is the code

ifstream file("fileName.txt");
while (getline(file,buffer,'\n')) {
// parse the buffer to get the desired data
// over write the data. in the end the last data will be saved.
}

No comments:

Cat

Ragdoll Cat         Persian Cat     Finish Cat