Is it safe to use a file descriptor and its associated FILE* stream simultaneously?

270 views Asked by At

I'm writing a C++ socket library to handle the intricacies of managing socket related system calls. I'm curious if there are any harmful side effects in creating a FILE* with fdopen(3) and using it alongside the client's original file descriptor.

I'd like to be able to do this because it provides greater flexibility in being able to use things such as select(2) while also using getline(3) (the primary goal of this question), however I fear that the FILE* will cause some issues with file descriptor based utilities (namely the internal buffering of a FILE* messing with select(2)'s ability to determine if there is data available for read(2)).

0

There are 0 answers