How do I get the file HANDLE from the fopen FILE structure?

后端 未结 3 1724
面向向阳花
面向向阳花 2020-12-03 09:49

The fopen function returns a pointer to a FILE structure,

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 10:32

    For C, try this

    HANDLE foo = (HANDLE)_get_osfhandle(fileno(fopen("bar.txt", "w")));
    

提交回复
热议问题