Building a stream from a stdio file

Is it possible to create an outstream object from a given stdio file (an old style style file descriptor)? Preferably without closing and reopening the file.

For this, I have a stdio file, and the library that I use takes a stream object.

+4
source share
1 answer

If using boost is an option, and the library accepts std::basic_ostream (unlike std::ofstream ), you can use the file system file descriptor wrap the file descriptor, build a stream and transfer it to your target library.

+1
source

Source: https://habr.com/ru/post/1380493/


All Articles