...
Code Block | ||
---|---|---|
| ||
char *file_name; FILE *fp; /* initialize file_name */ fp = fopen(file_name, "r"); if (!fp) { /* file does not exist */ fp = fopen(file_name, "w"); /* ... */ fclose(fp); } else { /* file exists */ fclose(fp); } |
...
Code Block | ||
---|---|---|
| ||
char *file_name;
/* initialize file_name */
FILE *fp = fopen(file_name, "wx");
if (!fp) {
/* Handle Error */
}
|
...