Part of Code 1:-
while(1)
{
ch=fgetc(pt);
if(c==EOF)
{
break;
}
if(c==\' \')
{
f
The use of fseek()
here - The C standard requires a positioning operation between a read and a write operation on an update stream, or between a write and a read. This is a positioning operation between a write and a read. It is not a no-op; it places the stream into a mode which allows the next fgetc()
to work correctly, reliably, across platforms, as required by the C standard.
EDIT:
2 fseek()
calls are required because the first one acts as the "no-op" call between an fgetc()
and a subsequent fputc()
call. After the fputc()
, the second one acts as the "no-op" between the fputc()
and the subsequent fgetc()
call. (since a loop is running)