#include <unistd.h>
#include <fcntl.h>

void main()
{
  // 0 = stdin, 1 = stdout, 2 = stderr

  char array[256];
  int read_fd = open("./sample.txt", O_RDONLY);
  int write_fd = 2; // stdout

  int b = 0;

  do {
    b = read(read_fd, array, 255);
    write(write_fd, array, b);
  } while(b > 0);

  close(read_fd);
}