getline

hi,i'm reading from a file by using getline(),now depending on my logic i have to go back exactly no.of characters read by getline so i can read that line again pls help


ACTUALLY I AM MERGING 3 FILES IN FOLLOWING MANNER
-CONSIDER FIRST LINE OF FIRST FILE
-COMPARE IT WITH FIRST LINE OF SECOND FILE
-IF EQUAL THEN ONLY CONSIDER 3RD FILES FIRST LINE.
NOW SUPPOSE IF LINE DOES NOT MATCHE THEN I HAVE TO BACKTRACK SO THAT I COULD CHECK IT AGAIN.NOW BY GETLINE I READ LINE,WHAT CAN BE DONE TO GO BACK TO THE SAME LINE seekg() NOT WORKING.
Last edited on
What do you mean by "go back"? And it would be much appreciated if you were to use capital letters and spaces around punctuation where appropriate...
sounds like the OP wants to put the line back into the buffer

you can try:

http://www.cplusplus.com/reference/iostream/istream/putback/
Topic archived. No new replies allowed.