If you can not use MFC classes and would like to make those things more portable, try using _fdopen. This IS supported in Windows api. But still, when you port this piece code to LINUX, make sure modify the code.
You can do like this in the header file:
#define _fdopen fdopen
OR
You can modify your makefile and pass in pre-compiler options when on LINUX. likely say -DLINUX
then in the code, you can write:
#ifdefine LINUX
fdopen(.....)
#elif
_fdopen(....)
#endif