c check if file was created

C
int canCreateFile(char* path)
{
	FILE* file = fopen(path, "w");
  	if(file)
    {
  		fclose(file);
      	return 1;
    }
  	return 0;
}
Source

Also in C: