#include #include #include #include //errno -l //show with binary file. int main(int argc, char *argv[]){ if(argc < 2){ fprintf(stderr, "Usage %s filename\n", argv[0]); return 1; } //change to argv //Try empty file //File that does not exist int fd = open(argv[1], O_RDONLY); printf("%d\n", fd); if (fd < 0) { //fprintf(stderr, "Could not open file (code %d)\n", errno); perror("Open"); return 1; } char c; //Read more than 1 byte? while (read(fd, &c, 1) > 0) { printf("%c", c); } close(fd); return 0; }