Hello.
I want to read the previous line with ifstream, while somewhere in the middle of the file.
How do I do this?
Thanks in advance.
tellg Get position of the get pointer. (public member function)
seekg Set position of the get pointer (public member function )
fstream - C++ Reference
Use tellg() before you read a line, and store the answer somewhere.
Passing that value to seekg() will allow you to re-read the same line.
tellg Get position of the get pointer. (public member function)
seekg Set position of the get pointer (public member function )
fstream - C++ Reference
Use tellg() before you read a line, and store the answer somewhere.
Passing that value to seekg() will allow you to re-read the same line.
Thanks.
That worked.
C++ Tutorial
5 ways you can learn to program faster
The 5 Most Common Problems New Programmers Face
How to set up a compiler
8 Common programming Mistakes
What is C++11?
Creating a game, from start to finish
Recent additions
How to create a shared library on Linux with GCC
- December 30, 2011
Enum classes and nullptr in C++11
- November 27, 2011
Learn about The Hash Table
- November 20, 2011
Rvalue References and Move Semantics in C++11
- November 13, 2011
C and C++ for Java Programmers
- November 5, 2011
A Gentle Introduction to C++ IO Streams
- October 10, 2011