#include void main() { char buffer[256]; FILE* read_f = fopen("./sample.txt", "r"); FILE* write_f = stdout; int b = 0; 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); }