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