简体   繁体   中英

creating a fstream object from memory buffer

Suppose I have some memory allocated by malloc. Now i want to use it as stream buffer as fstream object. In another situation suppose i've a FILE*. Is it possible to create a fstream object from it?


Actually I've an existing library which accepts FILE* arguments in it's function.Now I want to implement the library with cpp type file handling, maintaining backward compatability . What should I do?

You can not make a fstream object from a FILE* .

You should personally write a stream based on C++ standard I/O streams which works by a FILE*

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