<?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[Pipes übertragen nich alle Ausgaben von ext. Prog]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich hab eine MFC-Anwendung, die eine externe EXE mit CreateProcess startet und über Pipes mit ihr kommuniziert.<br />
Die externe EXE ist PLink (Teil von Putty).<br />
Ich habe nun das Problem, dass nich alle Ausgaben von Plink in meinen Pipes ankommen.<br />
Meistens Fehlermeldung oder so.</p>
<p>- PLink ohne Parameter aufrufen (-&gt; Hilfe aufrufen) funzt<br />
- PLink mit allen notwendigen Parametern aufrufen (-&gt; erfolgreicher LogIn) funzt<br />
- LogOut aus PLink funzt</p>
<p>kommt jetzt aber eine Meldung, dass der Login fehlerhaft war, kann ich die Antwort nich aus meiner Pipe lesen.</p>
<p>Kann das daran liegen, wie PLink das ausgibt?</p>
<p>Danke schonmal!</p>
<p>Gruß Tody</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/46999/pipes-übertragen-nich-alle-ausgaben-von-ext-prog</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 21:37:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/46999.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Aug 2003 13:09:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pipes übertragen nich alle Ausgaben von ext. Prog on Mon, 25 Aug 2003 13:09:49 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich hab eine MFC-Anwendung, die eine externe EXE mit CreateProcess startet und über Pipes mit ihr kommuniziert.<br />
Die externe EXE ist PLink (Teil von Putty).<br />
Ich habe nun das Problem, dass nich alle Ausgaben von Plink in meinen Pipes ankommen.<br />
Meistens Fehlermeldung oder so.</p>
<p>- PLink ohne Parameter aufrufen (-&gt; Hilfe aufrufen) funzt<br />
- PLink mit allen notwendigen Parametern aufrufen (-&gt; erfolgreicher LogIn) funzt<br />
- LogOut aus PLink funzt</p>
<p>kommt jetzt aber eine Meldung, dass der Login fehlerhaft war, kann ich die Antwort nich aus meiner Pipe lesen.</p>
<p>Kann das daran liegen, wie PLink das ausgibt?</p>
<p>Danke schonmal!</p>
<p>Gruß Tody</p>
]]></description><link>https://www.c-plusplus.net/forum/post/340109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/340109</guid><dc:creator><![CDATA[Tody]]></dc:creator><pubDate>Mon, 25 Aug 2003 13:09:49 GMT</pubDate></item><item><title><![CDATA[Reply to Pipes übertragen nich alle Ausgaben von ext. Prog on Mon, 25 Aug 2003 14:48:25 GMT]]></title><description><![CDATA[<p>Es gibt 2 Ausgebe-Pipes, die normalerweise auf der Konsole dargestellt werden. Das ist stdout und stderr. Beide Pipes kann man getrennt umleiten und Fehlermeldungen kommen korrekterweise auf stderr.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/340191</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/340191</guid><dc:creator><![CDATA[DJohn]]></dc:creator><pubDate>Mon, 25 Aug 2003 14:48:25 GMT</pubDate></item><item><title><![CDATA[Reply to Pipes übertragen nich alle Ausgaben von ext. Prog on Wed, 10 Sep 2003 07:30:18 GMT]]></title><description><![CDATA[<p>Das klingt einleuchtend.</p>
<p>Ich berücksichtige stderr garnicht. Ich geb mich mal ran.</p>
<p>Mal sehen ob es klappt.</p>
<p>Danke auf jeden Fall!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/350613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/350613</guid><dc:creator><![CDATA[Tody]]></dc:creator><pubDate>Wed, 10 Sep 2003 07:30:18 GMT</pubDate></item><item><title><![CDATA[Reply to Pipes übertragen nich alle Ausgaben von ext. Prog on Wed, 10 Sep 2003 12:29:01 GMT]]></title><description><![CDATA[<p>also, ich komm irgendwie nich weiter.</p>
<p>ich hab so meine probleme mit den handles. das geht schon los bei den handles der pipes.<br />
ich hab ja 2 pipes (output und input). alle beispiele und hilfen zu pipes, die ich bis jetzt gefunden hab, beziehen sich auf ne win32-anwendung.</p>
<p>jetzt gibt es beispiele bei denen eine pipe mit 2 handles erstellt wird und danach ein handle dupliziert wird:</p>
<pre><code class="language-cpp">// STDOUT holen
	hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

	// anonymous StdOutPipe erstellen
	if (!CreatePipe(&amp;hOutRead,&amp;hOutWrite,&amp;sa,NULL))
	{
		printf(&quot;\ncmd: CreateOutPipe failed!\n&quot;);
		return 0;
	}
	// hOutWrite als STDOUT setzen
	if (!SetStdHandle(STD_OUTPUT_HANDLE, hOutWrite))
	{
		printf(&quot;\ncmd: SetStdHandle(hOutWrite) failed!\n&quot;);
		return 0;
	}
	// nicht-vererbbares Lese-Handle erstellen
	bSuccess = DuplicateHandle(GetCurrentProcess(), hOutRead,
		GetCurrentProcess(), &amp;hOutReadDpl , 0,
		FALSE,
		DUPLICATE_SAME_ACCESS);
	if( !bSuccess )
		printf(&quot;\nDuplicateHandle failed (hOutRead)&quot;);

	// vererbbares Lese-Handle schließen
	CloseHandle(hOutRead);
</code></pre>
<p>dann gibt es beispiele, bei denen das duplizieren weggelasen wird.</p>
<p>kann mir jemand erklären warum das gemacht wird?</p>
<p>ein weiteres problem ist, dass ich stderr auslesen will und das klappt auch nich so. das ganze soll ja in mfc laufen. dazu hab ich mir in InitInstance() ne konsole geholt. damit hab ich dann auch stdin und stdout.</p>
<p>ich mache folgendes:</p>
<pre><code class="language-cpp">// Set the bInheritHandle flag so pipe handles are inherited. 
	saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); 
	saAttr.bInheritHandle = TRUE; 
	saAttr.lpSecurityDescriptor = NULL; 

	// The steps for redirecting child process's STDOUT: 
	//     1. Save current STDOUT, to be restored later. 
	//     2. Create anonymous pipe to be STDOUT for child process. 
	//     3. Set STDOUT of the parent process to be write handle to 
	//        the pipe, so it is inherited by the child process. 

	// Save the handle to the current STDOUT.  
	hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE); 

	// Create a pipe for the child process's STDOUT. 
	if (! CreatePipe(&amp;hChildStdoutRd, &amp;hChildStdoutWr, &amp;saAttr, 0)) {
		throw new CMyException(&quot;Stdout pipe creation failed\n&quot;); 
	}
	// Set a write handle to the pipe to be STDOUT. 
	if (! SetStdHandle(STD_OUTPUT_HANDLE, hChildStdoutWr)) { 
		throw new CMyException(&quot;Redirecting STDOUT failed&quot;); 
	}

	// The steps for redirecting child process's STDIN: 
	//     1.  Save current STDIN, to be restored later. 
	//     2.  Create anonymous pipe to be STDIN for child process. 
	//     3.  Set STDIN of the parent to be the read handle to the 
	//         pipe, so it is inherited by the child process. 

	// Save the handle to the current STDIN. 
	hSaveStdin = GetStdHandle(STD_INPUT_HANDLE); 

         // versuch
	// Save the handle to the current STDERR.  
	hChildError = GetStdHandle(STD_ERROR_HANDLE); 

	// Create a pipe for the child process's STDIN. 
	if (! CreatePipe(&amp;hChildStdinRd, &amp;hChildStdinWr, &amp;saAttr, 0)) {
		throw new CMyException(&quot;Stdin pipe creation failed\n&quot;); 
	}
	// Set a read handle to the pipe to be STDIN. 
	if (! SetStdHandle(STD_INPUT_HANDLE, hChildStdinRd)) { 
		throw new CMyException(&quot;Redirecting Stdin failed&quot;); 
	}

	// Now create the child process. 
	if (! CreateChildProcess()) {
		throw new CMyException(&quot;Create process failed&quot;); 
	}

	// After process creation, restore the saved STDIN and STDOUT. 
	if (! SetStdHandle(STD_INPUT_HANDLE, hSaveStdin)) {
		throw new CMyException(&quot;Re-redirecting Stdin failed\n&quot;); 
	}

	if (! SetStdHandle(STD_OUTPUT_HANDLE, hSaveStdout)) {
		throw new CMyException(&quot;Re-redirecting Stdout failed\n&quot;); 
	}
         // versuch
	if (! SetStdHandle(STD_ERROR_HANDLE, hChildError)) {
		throw new CMyException(&quot;Re-redirecting StdErr failed\n&quot;); 
	}
</code></pre>
<p>das sind alle handles, die so rumtrollen bei mir. das mit dem error-handle war nur ein versuch. wenn ich davon lese (readfile()) kommt das gleiche raus, wie wenn ich vom hStdOutputRd lese.</p>
<p>vielleicht kann mir ja jemand einen tip geben.</p>
<p>wäre sehr dankbar dafür!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/350855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/350855</guid><dc:creator><![CDATA[Tody]]></dc:creator><pubDate>Wed, 10 Sep 2003 12:29:01 GMT</pubDate></item></channel></rss>