...
Code Block | ||
---|---|---|
| ||
char data[BUFSIZ]; char append_data[BUFSIZ]; char *filenamefile_name; FILE *file; /* initialize filenamefile_name */ file = fopen(filenamefile_name, "a+"); if (file == NULL) { /* handle error */ } /* initialize append_data */ if (fwrite(append_data, BUFSIZ, 1, file) != BUFSIZ) { /* handle error */ } if (fread(data, BUFSIZ, 1, file) != 0) { /* handle there not being data */ } fclose(file); |
...
Code Block | ||
---|---|---|
| ||
char data[BUFSIZ]; char append_data[BUFSIZ]; char *filenamefile_name; FILE *file; /* initialize filenamefile_name */ file = fopen(filenamefile_name, "a+"); if (file == NULL) { /* handle error */ } /* initialize append_data */ if (fwrite(append_data, BUFSIZ, 1, file) != BUFSIZ) { /* Handle error */ } fflush(file); if (fread(data, BUFSIZ, 1, file) != 0) { /* handle there not being data */ } fclose(file); |
...