#include void main() { char buffer[256]; FILE* read_f = fopen("./sample.txt", "r"); FILE* write_f = stdout; int b = 0; // read the second half of the file by seeking to end // and rewinding to the midpoint. // fseek() does not return a position! // fp offset base fseek(read_f, 0, SEEK_END); b = ftell(read_f); fseek(read_f, (b/2), SEEK_SET); do { b = fread(buffer, 1, 255, read_f); fwrite(buffer, 1, b, write_f); } while(!feof(read_f)); // maybe need fflush(write_f); close(read_f); }