C++ – How to move the file pointer to next character through “ifstream” without “getting” any character, just like “fseek” does

cfile-ioifstream

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.

Best Answer

ifstream fin(...);
// ...

fin.get(); // <--- move one character
// or
fin.ignore(); // <--- move one character
Related Topic