Answers for "how to check if file is already created in c"

C
11

c check if file exists

if( access( fname, F_OK ) == 0 ) {
    // file exists
} else {
    // file doesn't exist
}
Posted by: Guest on January-06-2021
-1

c check if file was created

int canCreateFile(char* path)
{
	FILE* file = fopen(path, "w");
  	if(file)
    {
  		fclose(file);
      	return 1;
    }
  	return 0;
}
Posted by: Guest on June-29-2020

Code answers related to "how to check if file is already created in c"

Code answers related to "C"

Browse Popular Code Answers by Language