#include void main() { // 0 = stdin, 1 = stdout, 2 = stderr char buffer[256]; int read_fd = open("./sample.txt", O_RDONLY); int write_fd = 2; // stdout int b = 0; do { b = read(read_fd, buffer, 255); write(write_fd, buffer, b); } while(b > 0); close(read_fd); }