To check if a file exists in C you can use the follwing snippet.
Sample C
#include <unistd.h>
int fileExists(const char *filename) {
return !access(filename, F_OK);
}
All the Code Snippets and Samples you need
To check if a file exists in C you can use the follwing snippet.
#include <unistd.h>
int fileExists(const char *filename) {
return !access(filename, F_OK);
}
You must be logged in to post a comment.
RT @CodeSnippetsNET: How to check if a file exists in #C http://t.co/R8EpztWLa4 #programming #coding #code #dev #develop