I assume these functions are forbidden because of some assignment restriction, rather than technical? It depends what you want to do:
feof()
is for determining whether a stream is at the end of the file
fseek()
is for moving to a particular position in that file.
You can determine whether a stream is at the end of the file at read time. For example, from the man page for fscanf
:
The value EOF
is returned if an input failure occurs before any conversion such as an end-of-file occurs.
For moving around within a file without using fseek()
, you can use rewind()
from your allowed list.
From the man page for rewind()
:
The rewind() function sets the file position indicator for the stream pointed to by stream to the beginning of the file. It is equivalent to:
(void)fseek(stream, 0L, SEEK_SET)
From there, you'll have to read up to the point you wanted to seek()
to.