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:

Down with the Dictatorship!

    "Let them hate me, so that they fear me" - Caligula 41AD