I check the return value of fseek when the input filename is ".." and on Linux it returns -1, but on Cygwin it returns 0! I know that ".." is technically a directory. Can anyone give me some advice on how to catch this as an error?
Oh - the reason why the input file is ".." is because the Windows filepath uses the backslashes so I think they are seen as escape characters, so ..\..\bin\filen ame.txt only becomes ".." through my regex parser.
Oh - the reason why the input file is ".." is because the Windows filepath uses the backslashes so I think they are seen as escape characters, so ..\..\bin\filen ame.txt only becomes ".." through my regex parser.
Code:
ret = fseek( fp, 0L, SEEK_END );
if ( ret == -1 )
{
printf( "unable to open input file\n" );
fclose( fp );
return -1;
}