<?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[shell-Ausgabe auslesen]]></title><description><![CDATA[<p>Ich möchte ein shell-Kommando ausführen und die Ausgabe in einem String speichern!<br />
Bisher mach ich das so:</p>
<pre><code class="language-cpp">FILE *ping = popen(command, &quot;r&quot;);
	char ausgabe[501];
	int len = fread(ausgabe, 1, 500, ping);
	ausgabe[len]=0;
</code></pre>
<p>Ich will aber einen String der Klasse string und kein Array, wie geht das dann?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/170938/shell-ausgabe-auslesen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 07:20:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/170938.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 21 Jan 2007 11:24:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to shell-Ausgabe auslesen on Sun, 21 Jan 2007 11:24:07 GMT]]></title><description><![CDATA[<p>Ich möchte ein shell-Kommando ausführen und die Ausgabe in einem String speichern!<br />
Bisher mach ich das so:</p>
<pre><code class="language-cpp">FILE *ping = popen(command, &quot;r&quot;);
	char ausgabe[501];
	int len = fread(ausgabe, 1, 500, ping);
	ausgabe[len]=0;
</code></pre>
<p>Ich will aber einen String der Klasse string und kein Array, wie geht das dann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213586</guid><dc:creator><![CDATA[tyho]]></dc:creator><pubDate>Sun, 21 Jan 2007 11:24:07 GMT</pubDate></item><item><title><![CDATA[Reply to shell-Ausgabe auslesen on Sun, 21 Jan 2007 11:37:22 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Schau dir die Methode <em>std::string::c_str()</em> an</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213594</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213594</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 21 Jan 2007 11:37:22 GMT</pubDate></item><item><title><![CDATA[Reply to shell-Ausgabe auslesen on Sun, 21 Jan 2007 11:45:14 GMT]]></title><description><![CDATA[<p>Ja da bin ich auch schon draufgekommen, allerdings ist das nicht sonderlich schön...</p>
<p>Mein Problem ist, dass dieser Code in einer Schleife steht und ca. beim 750. Durchlauf ein Speicherzugriffsfehler in</p>
<pre><code class="language-cpp">int len = fread(ausgabe, 1, 500, ping);
</code></pre>
<p>auftritt.</p>
<p>Gibt es keine analoge Funktion für fread für strings aus &lt;string&gt;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1213600</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1213600</guid><dc:creator><![CDATA[tyho]]></dc:creator><pubDate>Sun, 21 Jan 2007 11:45:14 GMT</pubDate></item></channel></rss>