simple problem about fseek()
i have seen some thread discuss about using fseek() to tell the size of the file.
from the msdn, it said it will return -1L if there is error.
i would like to ask how to check if the return value is an error or not?(i think that is not an integer right?)
thank you.
Re: simple problem about fseek()
Quote:
Originally posted by Jasonymk
i have seen some thread discuss about using fseek() to tell the size of the file.
from the msdn, it said it will return -1L if there is error.
i would like to ask how to check if the return value is an error or not?(i think that is not an integer right?)
thank you.
If it succeeds, it returns zero. Otherwise, you can check errno for specific information about the error.
Code:
if (fseek(...) != 0)
{
switch (errno)
{
// ...
}
}
See here: http://www.mkssoftware.com/docs/man3/fseek.3.asp