C How to check if a file exists

When create a program related with IO, we want to check if a file exists or not. C/C++ have a function needed to check if a file exists or not. We can use some of function in stat.h to check if a file exists. This is a simple C How to check if a file exists.

Save this C How to check if a file exists code with name c_check_file.c
We can compile this C How to check if a file exists with command :

Call this binary C How to check if a file exists with command :

This is a simple C How to check if a file exists. If you have other method, please share to us.

Source :
http://www.developer.nokia.com/Community/Wiki/Checking_if_a_file_exists_in_Open_C_and_C%2B%2B

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.