A file handle is an integer, a FILE is a struct (that varies somewhat between implementations). Use "int _fileno (FILE *stream);" to get the handle from the FILE *. There is no error return. Operation is undefined if stream doesn not represent an open file.