# "GetLastError()" -> "errno" translation



## SnakeEye (May 19, 2008)

I wrote a utility aimed to be portable, which is trying
to use only open/read/write/close/perror/... of io.h
But for some reason I need to call Win32 API, with the
help of _get_osfhandle(fd). After such a call I used
to do errno=GetLastError(), but have accidentally found
some Win32 error codes are not properly "mapped" into
ones from errno.h
Does anybody know a way to gracefully convert a Win32
error number into the ANSI one?
The MSVCRT definitely has such a routine, but is it
documented?


----------

