I find everytime, one of my program call fopen, it can not open the existing file, but another program can.
The errno of fopen is 2, but I don't know what '2' means for fopen, please give me some advice.
Thanks.
Printable View
I find everytime, one of my program call fopen, it can not open the existing file, but another program can.
The errno of fopen is 2, but I don't know what '2' means for fopen, please give me some advice.
Thanks.
What language are you using? there's a few i can think of that have the fopen function :)
If you C use strerror(int errno) declared in string.h
It will be printed a human readable description of the error. See also perror...Code:#include ....
if (fopen("foo", "w+") < 0)
fprintf(stderr, "Error: %s.\n", strerror(errno));
errno 2 is ENOENT, No such file or directory. I suspect the path you're specifying in your code is wrong. If you post the relevant snippet we can advise further.