Vincent
Vincent

Reputation: 60471

C++ seekg to ignore a part of a file?

I have a very simple question in C++. What is the equivalent of

x = new char[length];
mystream.read(x, length*sizeof(char));
delete[] x;

with seekg to ignore a part of size length of a binary file ?

Thank you very much !

Upvotes: 1

Views: 681

Answers (1)

leftaroundabout
leftaroundabout

Reputation: 120751

You don't need seekg, just use istream::ignore.


If you insist on using seekg, the way to go is seekg(length, std::ios::cur).

Upvotes: 2

Related Questions