<?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[[gelöst! THX!!!]file.txt nach autostart beschreiben?]]></title><description><![CDATA[<p>Hallo,<br />
Ich bin relativ neu in C++ und hab schon öfter in diesem Forum Antworten gefunden. Bin mir relativ sicher, dass diese Frage hier nocht nicht gestellt wurde. Wenn doch sorry...</p>
<p>Also:<br />
Ich habe ein Programm, welches sich beim Hochfahren selbst aktiviert. Die Berechnungen funktionieren jedoch nur in der Console.<br />
Die errechneten Ergebnisse stehen in der Console, werden jedoch nicht in die file.txt geschrieben.<br />
Dies funktioniert jedoch wenn ich meine Programm.exe per Maus öffne.</p>
<p>Ich benutze Dev C++ 4.9.9.2 in Windows XP (glaub ich).<br />
Danke im vorraus für alle Antworten!!!</p>
<p>//////////////////////////////////////////////////////////////////////////<br />
////////////// Mein Code ist folgender: //////////////<br />
//////////////////////////////////////////////////////////////////////////</p>
<p>#include&lt;iostream&gt;<br />
#include&lt;windows.h&gt;<br />
#include&lt;winable.h&gt;<br />
#include&lt;fstream&gt;</p>
<p>using namespace std;</p>
<p>void autostart()<br />
{<br />
BYTE pfad[] = &quot;Laufwerk:\\Pfad\\Programm.exe&quot;;<br />
HKEY hkey;<br />
RegCreateKeyEx(HKEY_CURRENT_USER,<br />
&quot;Software\\Microsoft\\Windows\\CurrentVersion\\Run&quot;,<br />
0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &amp;hkey, 0);<br />
RegSetValueEx(hkey, &quot;key&quot;, 0, REG_SZ, pfad, sizeof(pfad));<br />
RegCloseKey(hkey);<br />
};</p>
<p>void abschreiben()<br />
{<br />
ofstream file;<br />
int length = 10;<br />
int a[length];</p>
<p>for(int i = 0; i &lt; length; i++) // array beschrieben mit 10 Zahlen<br />
{a[i] = i;}</p>
<p>for(int i = 0; i &lt; length; i++)<br />
{file.open(&quot;output.txt&quot;, ios::app);<br />
file &lt;&lt; a[i]; // file wird mit array beschrieben<br />
cout &lt;&lt; a[i];<br />
file.close();}<br />
};</p>
<p>int main()<br />
{<br />
autostart();<br />
abschreiben();<br />
system(&quot;PAUSE&quot;);<br />
return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/250776/gelöst-thx-file-txt-nach-autostart-beschreiben</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 20:52:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/250776.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Sep 2009 20:33:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Thu, 24 Sep 2009 13:34:03 GMT]]></title><description><![CDATA[<p>Hallo,<br />
Ich bin relativ neu in C++ und hab schon öfter in diesem Forum Antworten gefunden. Bin mir relativ sicher, dass diese Frage hier nocht nicht gestellt wurde. Wenn doch sorry...</p>
<p>Also:<br />
Ich habe ein Programm, welches sich beim Hochfahren selbst aktiviert. Die Berechnungen funktionieren jedoch nur in der Console.<br />
Die errechneten Ergebnisse stehen in der Console, werden jedoch nicht in die file.txt geschrieben.<br />
Dies funktioniert jedoch wenn ich meine Programm.exe per Maus öffne.</p>
<p>Ich benutze Dev C++ 4.9.9.2 in Windows XP (glaub ich).<br />
Danke im vorraus für alle Antworten!!!</p>
<p>//////////////////////////////////////////////////////////////////////////<br />
////////////// Mein Code ist folgender: //////////////<br />
//////////////////////////////////////////////////////////////////////////</p>
<p>#include&lt;iostream&gt;<br />
#include&lt;windows.h&gt;<br />
#include&lt;winable.h&gt;<br />
#include&lt;fstream&gt;</p>
<p>using namespace std;</p>
<p>void autostart()<br />
{<br />
BYTE pfad[] = &quot;Laufwerk:\\Pfad\\Programm.exe&quot;;<br />
HKEY hkey;<br />
RegCreateKeyEx(HKEY_CURRENT_USER,<br />
&quot;Software\\Microsoft\\Windows\\CurrentVersion\\Run&quot;,<br />
0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &amp;hkey, 0);<br />
RegSetValueEx(hkey, &quot;key&quot;, 0, REG_SZ, pfad, sizeof(pfad));<br />
RegCloseKey(hkey);<br />
};</p>
<p>void abschreiben()<br />
{<br />
ofstream file;<br />
int length = 10;<br />
int a[length];</p>
<p>for(int i = 0; i &lt; length; i++) // array beschrieben mit 10 Zahlen<br />
{a[i] = i;}</p>
<p>for(int i = 0; i &lt; length; i++)<br />
{file.open(&quot;output.txt&quot;, ios::app);<br />
file &lt;&lt; a[i]; // file wird mit array beschrieben<br />
cout &lt;&lt; a[i];<br />
file.close();}<br />
};</p>
<p>int main()<br />
{<br />
autostart();<br />
abschreiben();<br />
system(&quot;PAUSE&quot;);<br />
return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783298</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783298</guid><dc:creator><![CDATA[ComputerCarl]]></dc:creator><pubDate>Thu, 24 Sep 2009 13:34:03 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Wed, 23 Sep 2009 20:42:50 GMT]]></title><description><![CDATA[<p>Dein Programm gibt die Zeichen korrekt in eine Datei aus (welche übrigens output.txt heißt, nicht file.txt).</p>
<p>Abgesehen davon solltest du dich trotzdem unbedingt noch einmal mit Ein-/Ausgabe von Dateien beschäftigen. Das was du gemacht hast, ist umständlich und deutet darauf hin, dass du einiges nicht richtig verstanden hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783303</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 23 Sep 2009 20:42:50 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Wed, 23 Sep 2009 20:48:32 GMT]]></title><description><![CDATA[<p>Bei einem Neustart funktioniert es bei mir nicht. Nur per Maus...<br />
(ja output... stimmt. Hatte es nur schnell überflogen)<br />
Aber es wäre so korrekt?<br />
Woran könnte es liegen, dass es nach mehrfachen Tests bei mir nicht in die file schreibt?<br />
Und wie würde es einfacher gehen? Hatte es so gelernt.<br />
Vielen Dank für schnelle antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783308</guid><dc:creator><![CDATA[ComputerCarl]]></dc:creator><pubDate>Wed, 23 Sep 2009 20:48:32 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Thu, 24 Sep 2009 05:54:08 GMT]]></title><description><![CDATA[<p>du öffnest die datei ein bisschen zu oft?<br />
such mal nach der datei, wahrscheinlich existiert sie nicht dort, wo du sie vermutest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783377</guid><dc:creator><![CDATA[open n00b]]></dc:creator><pubDate>Thu, 24 Sep 2009 05:54:08 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Thu, 24 Sep 2009 11:19:41 GMT]]></title><description><![CDATA[<p>open n00b schrieb:</p>
<blockquote>
<p>du öffnest die datei ein bisschen zu oft?<br />
such mal nach der datei, wahrscheinlich existiert sie nicht dort, wo du sie vermutest.</p>
</blockquote>
<p>Ja in dem Fall öffne ich die Datei zu oft. Ich habe nur das Programm auf das Nötigste abgespeckt, damit man es schneller versteht. Für mein Programm ist es wichtig (denke ich jedenfalls <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> ).<br />
Die Datei muss da sein, wo ich sie vermute, denn wenn ich das Programm per Mausklick starte, funktioniert es einwandfrei.<br />
Wie gesagt im &quot;Autostart&quot; funktioniert nur das 'Output.exe' beschreiben nicht.<br />
Console schon...</p>
<p>Funktionert es vielleicht bei jemand anderen noch?<br />
Sonst liegt der Fehler vielleicht irgendwo an meinem PC oder so...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783519</guid><dc:creator><![CDATA[ComputerCarl]]></dc:creator><pubDate>Thu, 24 Sep 2009 11:19:41 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Thu, 24 Sep 2009 12:41:17 GMT]]></title><description><![CDATA[<p>ComputerCarl schrieb:</p>
<blockquote>
<p>).<br />
Die Datei muss da sein, wo ich sie vermute, denn wenn ich das Programm per Mausklick starte, funktioniert es einwandfrei.</p>
</blockquote>
<p>Hier liegt wahrscheinlich das Problem. Es gibt ja so etwas wie ein Arbeitsverzeichnis und das ist womöglich unterschiedlich je nach Startmethode. Da deine Datei relative Pfadangaben verwendet, vermute ich mal, dass die Ausgabe in einem anderen Verzeichnis landet als du erwartest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783557</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783557</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 24 Sep 2009 12:41:17 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Thu, 24 Sep 2009 13:09:05 GMT]]></title><description><![CDATA[<p>Oh...<br />
Stimmt ich hab meine Output.txt bei &quot;Dokumente und Einstellungen\Administrator&quot;<br />
gefunden. Ich weiss zwar nicht ganz warum und leider auch nicht was relative Pfadangaben sind (kleine indirekte Frage <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> )<br />
Aber schon mal vielen Dank an alle.<br />
Ich hatte wohl vorher nicht ganz verstanden, was gemeint wurde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783573</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783573</guid><dc:creator><![CDATA[ComputerCarl]]></dc:creator><pubDate>Thu, 24 Sep 2009 13:09:05 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst! THX!!!]file.txt nach autostart beschreiben? on Thu, 24 Sep 2009 13:16:50 GMT]]></title><description><![CDATA[<p>ComputerCarl schrieb:</p>
<blockquote>
<p>Oh...<br />
Stimmt ich hab meine Output.txt bei &quot;Dokumente und Einstellungen\Administrator&quot;<br />
gefunden. Ich weiss zwar nicht ganz warum und leider auch nicht was relative Pfadangaben sind (kleine indirekte Frage <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> )</p>
</blockquote>
<p><a href="http://de.wikipedia.org/wiki/Pfadname" rel="nofollow">Kleine direkte Antwort.</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1783577</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1783577</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 24 Sep 2009 13:16:50 GMT</pubDate></item></channel></rss>