Hi Guys,
fseek() return 0 on succses and nonZero when failed.
For example the following code returns -1
Code:
FILE *fpRead;
int iResult;
fpRead=fopen("textfile.txt","rt");
if (fpRead==NULL)
{
puts("File not found!");
exit(1);
}
iResult=fseek(fpRead,-10,SEEK_SET);
This make sense because I am trying to move backward from the beginning of the file.
My question is, Why is the following code don't return the same error and show succses??
Code:
FILE *fpRead;
int iResult;
fpRead=fopen("textfile.txt","rt");
if (fpRead==NULL)
{
puts("File not found!");
exit(1);
}
iResult=fseek(fpRead,100000L,SEEK_END);
My text file is only 340 bytes and still this code progress 100,000 bytes, How can it be?
Thank you !!!