简体   繁体   中英

Windows IStream interface on std::istream

Within C++ on Windows, is there any easy way to create a (COM) IStream interface to an existing std::stream object?

An example would be to read an image with IWICStream::InitializeFromIStream() from std::cin .

There is no standard implementation for that. You need to write your class (or find a third-party one) that implements the IStream interface and internally delegates to an std::stream as needed. However, you are likely to have trouble implementing IStream::Stat() , which is commonly used to retrieve a stream's data size. In the case of std::cin , you would not know how much data is being provided.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM