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:

Carlo Cipolla's Laws of Stupidity

    "By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...