fdopen() fix for windows