How can we convert FILE * to HANDLE?

Is there any way to convert the open FILE* returned from fopen to HANDLE , which is used in the Windows API functions? If so, how?

+6
source share
1 answer

(HANDLE) _get_osfhandle ( _fileno ( file ) )

Good luck on 64-bit systems if you use Visual C ++ 2008 or earlier, because the return type is long on them. :(

+8
source

Source: https://habr.com/ru/post/888590/


All Articles