<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Daten aus boost::iostreams::stream lesen]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin ein bisschen am verzweifeln. Es geht um boost iostreams in Verbindung mit boost process.</p>
<p><a href="http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.synchronous_i_o" rel="nofollow">http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.synchronous_i_o</a></p>
<p>Im Grunde suche ich nur eine (weitere) Möglichkeit Daten aus einem boost::iostream::stream auszulesen.<br />
Unten im Code habe ich meinen Alternative Ansatz reingeschrieben.<br />
Bei diesem hängt sich das Projekt jedoch auf.<br />
Leider werde ich aus der boost Dokumentation nicht ganz schlau.</p>
<p><a href="http://www.boost.org/doc/libs/1_43_0/libs/iostreams/doc/functions/read.html" rel="nofollow">http://www.boost.org/doc/libs/1_43_0/libs/iostreams/doc/functions/read.html</a></p>
<pre><code>#include &lt;boost/process/mitigate.hpp&gt;
#include &lt;boost/process.hpp&gt;
#include &lt;boost/iostreams/device/file_descriptor.hpp&gt;
#include &lt;boost/iostreams/stream.hpp&gt;
#include &lt;boost/filesystem.hpp&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;

int main(int argc, char** argv)
{
    namespace bp = ::boost::process;
    namespace bpi = boost::process::initializers;
    namespace bio = boost::iostreams;

    boost::process::pipe p = boost::process::create_pipe();
    bio::file_descriptor_sink sink(p.sink, bio::close_handle);
    boost::system::error_code ec;

    bp::child c = bp::execute(
        bpi::run_exe(boost::filesystem::path(&quot;test.exe&quot;)),
        bpi::set_on_error(ec),
        bpi::bind_stdout(sink)
    );
    bp::wait_for_exit(c);
    bio::file_descriptor_source source(p.source, bio::close_handle);
    bio::stream&lt;bio::file_descriptor_source&gt; is(source);
    std::string s;
    std::getline(is, s); // Alterantive zu diesem std::getline?
    // ---- Alternative ----
    // char data[100];
    // std::streamsize read = bio::read(is, &amp;data[0], 100);
    std::cout &lt;&lt; s &lt;&lt; std::endl;
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/337802/daten-aus-boost-iostreams-stream-lesen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 18:08:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/337802.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 30 Apr 2016 00:49:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Daten aus boost::iostreams::stream lesen on Sat, 30 Apr 2016 00:49:19 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin ein bisschen am verzweifeln. Es geht um boost iostreams in Verbindung mit boost process.</p>
<p><a href="http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.synchronous_i_o" rel="nofollow">http://www.highscore.de/boost/process0.5/boost_process/tutorial.html#boost_process.tutorial.synchronous_i_o</a></p>
<p>Im Grunde suche ich nur eine (weitere) Möglichkeit Daten aus einem boost::iostream::stream auszulesen.<br />
Unten im Code habe ich meinen Alternative Ansatz reingeschrieben.<br />
Bei diesem hängt sich das Projekt jedoch auf.<br />
Leider werde ich aus der boost Dokumentation nicht ganz schlau.</p>
<p><a href="http://www.boost.org/doc/libs/1_43_0/libs/iostreams/doc/functions/read.html" rel="nofollow">http://www.boost.org/doc/libs/1_43_0/libs/iostreams/doc/functions/read.html</a></p>
<pre><code>#include &lt;boost/process/mitigate.hpp&gt;
#include &lt;boost/process.hpp&gt;
#include &lt;boost/iostreams/device/file_descriptor.hpp&gt;
#include &lt;boost/iostreams/stream.hpp&gt;
#include &lt;boost/filesystem.hpp&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;

int main(int argc, char** argv)
{
    namespace bp = ::boost::process;
    namespace bpi = boost::process::initializers;
    namespace bio = boost::iostreams;

    boost::process::pipe p = boost::process::create_pipe();
    bio::file_descriptor_sink sink(p.sink, bio::close_handle);
    boost::system::error_code ec;

    bp::child c = bp::execute(
        bpi::run_exe(boost::filesystem::path(&quot;test.exe&quot;)),
        bpi::set_on_error(ec),
        bpi::bind_stdout(sink)
    );
    bp::wait_for_exit(c);
    bio::file_descriptor_source source(p.source, bio::close_handle);
    bio::stream&lt;bio::file_descriptor_source&gt; is(source);
    std::string s;
    std::getline(is, s); // Alterantive zu diesem std::getline?
    // ---- Alternative ----
    // char data[100];
    // std::streamsize read = bio::read(is, &amp;data[0], 100);
    std::cout &lt;&lt; s &lt;&lt; std::endl;
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2494582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2494582</guid><dc:creator><![CDATA[boostlerrr]]></dc:creator><pubDate>Sat, 30 Apr 2016 00:49:19 GMT</pubDate></item><item><title><![CDATA[Reply to Daten aus boost::iostreams::stream lesen on Sat, 30 Apr 2016 12:47:07 GMT]]></title><description><![CDATA[<p>Ich habs rausgefunden. Damit funktioniert alles wie gewünscht.</p>
<pre><code>std::streamsize read = bio::read(p.source /* hier direkt die source und nicht den stream angeben*/, &amp;data[0], 100);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2494603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2494603</guid><dc:creator><![CDATA[boostlerrr]]></dc:creator><pubDate>Sat, 30 Apr 2016 12:47:07 GMT</pubDate></item></channel></rss>