Wednesday, 15 July 2015

fileno cast FILE to descriptor C -



fileno cast FILE to descriptor C -

is there way cast variable of type int (file descriptor) type file in c ? have open pipe fd , want utilize functions expect file.

you can't cast it, can phone call fdopen(3), want:

file * fdopen(int fildes, const char *mode);

the fdopen() function associates stream existing file descriptor, fildes. mode of stream must compatible mode of file descriptor. when stream closed via fclose(3), fildes closed also.

c file-descriptor

No comments:

Post a Comment