GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

C: Using fseek() function instead of EOF macro

I have a question about using fseek() function instead of EOF macro.
For example, if I want to make a copy of a file:

while(char ch != EOF)
{
   //put char by char into a new file
}

This will copy entire content from the original file.

If I want to copy only to the specific location, why this won't work:

while(char ch != (char)fseek(fptr,10,SEEK_SET))
{
    //put char by char into a new file
}

My question is how to use function fseek() in a loop?

asked Nov 11, 2015 by display_error

1 Answer

fseek does not return the char at the position it points.

answered Nov 11, 2015 by Franko
...