<?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[Ausgabe von externem Programm in Datei umleiten]]></title><description><![CDATA[<p>ich habe mir das bcb example wintool angeschaut, weil ich die ausgabe von einem ausgeführten programm in eine datei speichern möchte. dort steht dann irgendwas von pipes und bla... ich steig da einfach nicht durch... könnte das mal jemand für mich auf das wesentliche beschränken? wenn ich das einfach über system() mache kann ich ja &gt;&gt; verwenden, und dann haben ich aber immer so ein sch... dos-fenster, was ich zu verhindern versuche... thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/81444/ausgabe-von-externem-programm-in-datei-umleiten</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 14:22:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/81444.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 31 Jul 2004 18:22:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ausgabe von externem Programm in Datei umleiten on Sat, 31 Jul 2004 18:23:17 GMT]]></title><description><![CDATA[<p>ich habe mir das bcb example wintool angeschaut, weil ich die ausgabe von einem ausgeführten programm in eine datei speichern möchte. dort steht dann irgendwas von pipes und bla... ich steig da einfach nicht durch... könnte das mal jemand für mich auf das wesentliche beschränken? wenn ich das einfach über system() mache kann ich ja &gt;&gt; verwenden, und dann haben ich aber immer so ein sch... dos-fenster, was ich zu verhindern versuche... thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/572303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/572303</guid><dc:creator><![CDATA[Konsti]]></dc:creator><pubDate>Sat, 31 Jul 2004 18:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to Ausgabe von externem Programm in Datei umleiten on Sat, 31 Jul 2004 20:04:41 GMT]]></title><description><![CDATA[<p>Wenn ich dich richtig verstanden habe, suchst du das hier: <a href="http://msdn.microsoft.com/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp" rel="nofollow">Creating a Child Process with Redirected Input and Output</a>, oder?! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/572338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/572338</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 31 Jul 2004 20:04:41 GMT</pubDate></item><item><title><![CDATA[Reply to Ausgabe von externem Programm in Datei umleiten on Sun, 01 Aug 2004 09:14:55 GMT]]></title><description><![CDATA[<p>also ich habe jetzt einen code geschrieben, der funktioniert auch recht gut, aber der haut so ca. in jeder 216. Zeile 2 Müllzeichen rein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /><br />
weiß jemand woran das liegen könnte?</p>
<pre><code class="language-cpp">SECURITY_DESCRIPTOR sd;
	      SECURITY_ATTRIBUTES sa;
         LPSECURITY_ATTRIBUTES lpsa = NULL;
         if (IsWindowsNT())
         {
        	   InitializeSecurityDescriptor(&amp;sd, SECURITY_DESCRIPTOR_REVISION);
            SetSecurityDescriptorDacl(&amp;sd, true, NULL, false);
            sa.nLength = sizeof(SECURITY_ATTRIBUTES);
            sa.bInheritHandle = true;
            sa.lpSecurityDescriptor = &amp;sd;
            lpsa = &amp;sa;
         }
         HANDLE hReadPipe;
         HANDLE hWritePipe;
         assert(CreatePipe(&amp;hReadPipe, &amp;hWritePipe, lpsa, 2500000));

         STARTUPINFO si;
         memset(&amp;si, 0, sizeof(STARTUPINFO));
         si.cb = sizeof(STARTUPINFO);
         si.dwFlags = STARTF_USESHOWWINDOW |STARTF_USESTDHANDLES;
         si.wShowWindow = SW_HIDE;
         si.hStdOutput = hWritePipe;
         si.hStdError = hWritePipe;
         PROCESS_INFORMATION pi;
         assert(hWritePipe);

         if(CreateProcess(NULL, (file+&quot; &quot;+para).c_str(), NULL, NULL, TRUE, 0, 0, 0, &amp;si, &amp;pi))
         {
        	   CloseHandle(pi.hThread);
        	   WaitForSingleObject(pi.hProcess, 90000);

       	 	// read from the pipe and put in richedit
           	assert(hReadPipe);
           	DWORD BytesRead; //unsigned long
           	char dest[4000];
        	   bool RdLoopDone = false;
           	ResultsRE-&gt;Lines-&gt;Clear();
           	int FBreak = 1;
           	while (!RdLoopDone)
           	{
           		   memset(dest, 0, 4000);
               	assert(ReadFile(hReadPipe, &amp;dest, sizeof(dest), &amp;BytesRead, NULL));
               	ResultsRE-&gt;Lines-&gt;Add(String(dest));
            	   if (BytesRead &lt; 4000)
                  {
                     RdLoopDone = true;
                  }
               	if (FBreak &gt; 150)
                  {
                     RdLoopDone = true;
                  }
               	FBreak++;
           	}
         }
         ResultsRE-&gt;Lines-&gt;SaveToFile(open);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/572544</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/572544</guid><dc:creator><![CDATA[Konsti]]></dc:creator><pubDate>Sun, 01 Aug 2004 09:14:55 GMT</pubDate></item></channel></rss>