How to move the file pointer to next character through "ifstream" without "getting" any character, just like "fseek" does?

Aquarius_Girl picture Aquarius_Girl · Jun 2, 2011 · Viewed 18.2k times · Source

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.

Answer

Yakov Galka picture Yakov Galka · Jun 2, 2011
ifstream fin(...);
// ...

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