S
subramanian100in
Suppose I open a text file in 'read' mode and assume fopen is
successful. Suppose this input file contains only few characters and
no new line(I am working on LINUX based machine. In this environment I
can create the above input file as follows:
cat > input
123 followed by ctrl-d twice. Then this 'input' file will contain only
123 and no end of line)
If I use fgets on this 'input' file, it will fetch '123' and EOF
indicator will be set. Now if I say clearrerr(fp) where fp was
returned by fopen, then the end of file indicator on fp should be
cleared by clearerr call. Does 'clearing the end of file indicator'
mean that we can start reading input from the same stream from the
beginning of the file ? If not, what does 'clearing the end of file
indicator' mean ?
Kindly clarify.
Thanks
V.Subramanian
successful. Suppose this input file contains only few characters and
no new line(I am working on LINUX based machine. In this environment I
can create the above input file as follows:
cat > input
123 followed by ctrl-d twice. Then this 'input' file will contain only
123 and no end of line)
If I use fgets on this 'input' file, it will fetch '123' and EOF
indicator will be set. Now if I say clearrerr(fp) where fp was
returned by fopen, then the end of file indicator on fp should be
cleared by clearerr call. Does 'clearing the end of file indicator'
mean that we can start reading input from the same stream from the
beginning of the file ? If not, what does 'clearing the end of file
indicator' mean ?
Kindly clarify.
Thanks
V.Subramanian