You are here:

C/Followup Question

Advertisement


Question
Hi,
 Thanks for your hint on retrieving the error message on opening an odd file format. I used fopen to open the file. Based on the error message, it is not reported correctly. The errno is 2 which stands for 'no such file or directory'. I verified and noted the file is in the right spot! Really weird! The filename is cabinet_1273-1-v1.bom.3. Is it possible that fopen failed to open a file with double '.' at the end of the name?

Answer
I don't think the double "." matters.
Check the file permissions.
Does everybody have "read" and "write" permissions?
Also, check all the directories in the path. Does all of them have correct permissions?
Is it a complete path or is it comprised of soft links?
Is it on the same system or a different host on the same subnet?
Could it be that, there is a mis-match in the uppercase/lowercase lettering in the file path name?

If the file is present there, then you must be able to open it with fopen().
Try to use "ls -l" on the filename that you are trying to open using fopen() (Copy and paste the exactly same name from the code), from the same directory where you are executing this executable.

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.