Programming Tips - Win32: get a Windows HANDLE from a standard C FILE * ?

Date: 2008jan2 Platform: win32 Language: C/C++ Q. Win32: get a Windows HANDLE from a standard C FILE * ? A. Like this:
#include <io.h> main() { FILE *f; HANDLE handle; f = fopen("myfile.txt", "r"); handle = (HANDLE) _get_osfhandle(fileno(f)); }