Versions Compared

Key

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

...

Code Block
bgColor#ccccff
char data[BUFSIZ];
char append_data[BUFSIZ];
char *file_name;
FILE *file;

/* initialize file_name */

file = fopen(file_name, "a+");
if (file == NULL) {
  /* handle error */
}

/* initialize append_data */

if (fwrite(append_data, BUFSIZ, 1, file) != BUFSIZ) {
  /* Handle error */
}

if (fseek(streamfile, 0L, SEEK_SET) != 0) {
  /* Handle Error */
}

if (fread(data, BUFSIZ, 1, file) != 0) {
  /* handle there not being data */
}

fclose(file);

...