Reading a byte at a specific file position in C ++

Is it possible to open a file and read only one byte at a certain position without having to load the entire file into an array?

For example, having a file of 10 bytes and reading the fifth.

+5
source share
2 answers

Yes, use istream :: seekg to find the position you want to read, and then istream :: get read bytes (or istream :: read read more than one byte).

+9
source

All Articles