My compiler (gcc) throws warnings (not errors!) on the line which declares fp:
int fd = open("filename.dat", O_RDONLY); FILE* fp = fdopen(fd, "r"); // get a file pointer fp from the file descriptor fd These are the warnings:
main.c: In function ‘main’: main.c:606: warning: implicit declaration of function ‘fdopen’ main.c:606: warning: initialization makes pointer from integer without a cast I do not understand these warnings since the return value of fopen is a FILE*. What is the mistake I am making here?
EDIT: I am including stdio.h (and I am also on Linux).
man fdopenlist any headers that you don't have?stdio.h.gcc 4.4.3with-g -O0 -std=c99 -Wall.