can we find out whether a file exists or not with out using the fopen command.......i am using the fopen command and when it encounters a file that doesnt exists it gives me segmentation error
i am using C in linux
can we find out whether a file exists or not with out using the fopen command.......i am using the fopen command and when it encounters a file that doesnt exists it gives me segmentation error
i am using C in linux
http://faq.cprogramming.com/cgi-bin/...&id=1043284392
When all else fails, read the faq.
Demonographic rhinology is not the only possible outcome, but why take the chance
>can we find out whether a file exists or not with out using the fopen command
Not with any real precision. You can find out if opening the file fails by calling fopen though. A file open failure usually means that the file doesn't exist, so you can make a few assumptions and be happy.
>it gives me segmentation error
Would that be because you're trying to use the resulting null pointer?
My best code is written with the delete key.
To find this infomation, you should look at the value of errno dirrectly after the fopen call. The function perror prints out this infomation somehow.