#include #include #include #include typedef struct basic_file basic_FILE; struct basic_file { //add int fd; }; basic_FILE *basic_fopen(char *file){ //add int fd = open(file, O_RDONLY); basic_FILE *f = malloc(sizeof(basic_FILE)); f->fd = fd; return f; } int basic_fgetc(basic_FILE *f){ //add int c; read(f->fd, &c,1); return c; } int main(int argc, char *argv[]) { if(argc < 2){ fprintf(stderr, "Usage %s filename\n", argv[0]); return 1; } //add basic_FILE *f = basic_fopen(argv[1]); int c = basic_fgetc(f); printf("%c",c); c = basic_fgetc(f); printf("%c",c); close(f->fd); return 0; }