#include <stdio.h> void main() { char array[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); b = 1; while (b > 0) { b = fread(array, 1, 255, read_f); fwrite(array, 1, b, write_f); } // maybe need fflush(write_f); fclose(read_f); }