Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
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
bgColor#ccccff
char *file_name;

/* initialize file_name */

FILE *fp = fopen(file_name, "wx");
if (!fp) {
  /* Handle Error */
}

...