C file input/output: Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit
Line 248:
}
 
forif (intfread(buffer, i1, =5, 0; ifp) < 5; i++) {
fputs("An error occurred while reading the file.\n", stderr);
int rc = getc(fp);
ifreturn (rc == EOF) {EXIT_FAILURE;
fputs("An error occurred while reading the file.\n", stderr);
return EXIT_FAILURE;
}
buffer[i] = rc;
}
 
fclose(fp);
 
printf("The bytes read were...: %02x %02x %02x %02x %02x\n", buffer[0], buffer[1],);
for (int i = 0; i < 5; ++i) {
buffer[2], buffer[3], buffer[4]);
printf("%02X ", buffer[i] = rc);
}
putchar('\n');
 
return EXIT_SUCCESS;