#include <stdio.h>
int file_exists(const char *filename);
int main(void)
{
if (file_exists("d:\\data.txt"))
printf("File exists");
else
printf("File does not exist.");
return 0;
}
int file_exists(const char *filename)
{
FILE *fp;
if ( (fp = fopen(filename, "r")) )
{
fclose(fp);
return 1;
}
return 0;
}
/*
run:
File exists
*/