On Tue, 7 Jan 2003, Dimitrie O. Paun wrote: [...]
Since program not using msvcrt expect only these funtions, that's what we need to provide. I don't know what get_osfhandle(), and setmode() are (they are not standard Unix functions), I've added included only access().
get_osfhandle() takes a Windows file handle (HANDLE as returned by CreateFile) and returns a small int you can use with read, write, close, etc.
setmode() lets you set the default file opening more: either TEXT (with LF -> CR/LF conversion) or BINARY (no conversion).
I can see how get_osfhandle() can be useful for interoperability in Cygwin. setmode() seems of a more dubious value though (especially since it means they must have implemented the awful CR/LF conversion across their C library API (unless setmode() is nothing but a stub)).