fopen fails and returns err
i have written a little lexer and if i compile it on my ancient debian laptop (which is where it will be deployed) the calls to fopen fail (i tried to write them using low level functions "open()" and it failed as well) it returns the error string that we are all familar with by now, no such file or directory.
but that file does exist and i do have permissions for it.
if i compile the same program on my osx machine, everything works out fine.
if i compile it with the low level
int file = open(argv[1], O_RDONLY | O_CREAT);
it doesnt set errno, but the file pointer is empty and i cant find a new file by that name
$ ./myprogram ~/input_file.suffix
$ locate input_file.suffix
/home/myhome/input_file.suffix
which already existed and hasnt been replace by an empty file
i am not sure if this is a kernel problem or a gcc problem or something that isnt really a problem but i am too dumb to figure out.
any help would be appreciated
|