Random Access
Learn how to jump to a different location when reading or writing to a file.
We'll cover the following...
We'll cover the following...
The need to move around
Sometimes when reading from or writing to file, we may want to jump to a different location in the file and start reading or writing from there. The fseek function lets us do exactly that. We can give the number of bytes after which the read or write is to take place. This is done by specifying a physical location and the offset in number of bytes from that location.
A physical location can be specified as one of the following arguments to fseek:
SEEK_SET: The beginning of the fileSEEK_CUR: The current position in the fileSEEK_END: The end of the file