Boost logo

Boost :

Subject: [boost] Problem with generating file_descriptor suing existing pipe file descriptor
From: Russell West (rgwest61_at_[hidden])
Date: 2019-04-10 20:45:42

Our program just installed version 69 of Boost and I am running into a
compile issue that I am not sure how to resolve. Following is the
associated section of C++ code that I am unable to figure out the changes
to get it to compile.

int filedes[2];
if ( pipe(filedes) == 0)
   using namespace boost::iostreams;
   stream<file_descriptor> results(filedes[0], close_handle);

The last provided line of code does not compile with a no matching function
for call to 'boost::iostreams::file_descriptor::file_descriptor(int&,
file_descriptor_flags&)' error.

I noticed in the version of the boost file_descriptor.hpp loaded and being
used the following exists:

    file_descriptor(int fd, file_descriptor_flags);

The associated application attempting to be built and deployed is only for
servers running the Linux operation system so BOOST_IOSTREAMS_WINDOWS is
not enabled, causing the above constructor not to be available.

The other constructor available is file_descriptor(handle_type fd,
but I can not figure out how to generate a detail::file_handle from the
available int file descriptor generated from above pipe command.

Will it cause any issues enabling BOOST_IOSTREAMS_WINDOWS so the required
constructor will be available?

Thanks ahead of time for your time and feedback.

Russell West

Boost list run by bdawes at, gregod at, cpdaniel at, john at