I came across the rewind()
function in C. I went through its description and example from here.
The description mentioned the following about the function:
The C library function
void rewind(FILE *stream)
sets the file position to the beginning of the file of the given stream.
I really didn't get the idea clear yet. Can we imagine it as a cursor moving in the file to be read, and rewind()
simply sets that cursor to the beginning of the file?
From the man page:
So the next time you read from a file after calling
rewind
, you start reading from the beginning. So your cursor analogy is a valid one.