seekg uses ios as the second argument, and ios can be set to end or beg or some other values as shown here: http://www.cplusplus.com/reference/iostream/ios/
I just want the pointer to move to the next character, how is that to be accomplished through ifstream?
EDIT Well, the problem is that I want a function in ifstream similar to fseek, which moves the pointer without reading anything.
ifstream fin(...);
// ...
fin.get(); // <--- move one character
// or
fin.ignore(); // <--- move one character
Yes. Its called seekg() as you seem to already know?
std::ifstream is("plop.txt" );
// Do Stuff
is.seekg (1, std::ios::cur); // Move 1 character forward from the current position.
Note this is the same as:
is.get();
// or
is.ignore();
Read the docs for seekg
and use ios_base::cur
as indicated there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With