Getting a HANDLE from a std::ofstream

后端 未结 6 1714
天涯浪人
天涯浪人 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:26

    This is not possible in standard C++. However, with Boost.IOStreams library it is not that hard. Create a Device, wrap it in a boost::iostreams::stream_buffer<> and add appropriate stream using boost::iostreams::stream<>.

提交回复
热议问题