#include #include #include #include //errno -l int main(int argc, char *argv[]){ //read 1 byte from "data.txt" and print it out. //check that file was opened correctly. int fd = open("data.txt",O_RDONLY); if(fd < 0) { //fprintf(stderr, "Could not open file Error code %d\n", errno); perror("Could not open file"); return 1; } unsigned char c; while(read(fd, &c, 1) > 0){ printf("%c", c); } close(fd); return 0; }