Getting a HANDLE from a std::ofstream

后端 未结 6 1744
天涯浪人
天涯浪人 2021-01-18 14:34

Is it possible to get the underlying file HANDLE from a std::ofstream (Visual C++ 2005)?

This is the opposite of this question:

Can I use CreateFile, but for

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-18 15:33

    No. I try many ways. this line: "std::ifstream ifs(fh);" may not wrok in some msvs, such as 2008.

    I find another way, you can enumerate handle in your process, and find the handle that releated to the filename.

    In this way, I get the handle.

提交回复
热议问题