Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: changed filenames from strings to some variable called file_name

...

Code Block
bgColor#FFCCCC
/* ... */
FILE *fp = fopen("foo.txt"file_name,"r");
if (!fp) { /* file does not exist */
  fp = fopen("foo.txt"file_name,"w");
  /* ... */
  fclose(fp);
} else {
   /* file exists */
  fclose(fp);
}
/* ... */

...

Code Block
bgColor#FFCCCC
/* ... */
FILE *fptr;
errno_t res = fopen_s(&fptr,"foo.txt"file_name, "r");
if (res != 0) { /* file does not exist */
  res = fopen_s(&fptr,"foo.txt"file_name, "w");
  /* ... */
  fclose(fptr);
} else {
  fclose(fptr);
}
/* ... */

...