Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    fopen errno message

    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.

  2. #2
    What language are you using? there's a few i can think of that have the fopen function
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  3. #3
    Linux User
    Join Date
    Aug 2005


    If you C use strerror(int errno) declared in string.h

    #include ....
    if &#40;fopen&#40;"foo", "w+"&#41; < 0&#41;
         fprintf&#40;stderr, "Error&#58; %s.\n", strerror&#40;errno&#41;&#41;;
    It will be printed a human readable description of the error. See also perror...
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (

  4. $spacer_open
  5. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts