<?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[I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>ich bin ein C++ Laie und muss kurzfristig eine .exe schreiben, dass auf eine Datei BGinput zugreift, die Daten (es sind Zeilenweise angeordnet 8 double - Variablen) einliest, berechnet und anschließend in einer anderen .txt ausgibt.</p>
<p>Zum Einlesen habe ich folgendes geschrieben, irgendwie klappts ned, kriege immer eine Fehlermeldung (s.u.)</p>
<p>int main(int argc, char* argv[]) {</p>
<p>double n_1;<br />
double n_sd;<br />
double n_2d;<br />
double P_sh;<br />
double d_max;<br />
double d_1i;<br />
double l_fwd;<br />
double l_aft;</p>
<p>ifstream inFile;<br />
inFile.open(&quot;GBinput.txt&quot;);<br />
if (inFile.fail()) {<br />
cerr &lt;&lt; &quot;unable to open file input.dat for reading&quot; &lt;&lt; endl;<br />
exit(1);<br />
}<br />
n_1=atof(argv[0]);<br />
n_sd=atof(argv[1]);<br />
n_2d=atof(argv[2]);<br />
P_sh=atof(argv[3]);<br />
d_max=atof(argv[4]);<br />
d_1i=atof(argv[5]);<br />
l_fwd=atof(argv[6]);<br />
l_aft=atof(argv[7]);</p>
<p>inFile.close();</p>
<p>Als Ausgabe habe ich folgendes geschrieben:</p>
<p>ofstream outFile;<br />
outFile.open(&quot;GBresults.txt&quot;);<br />
outFile &lt;&lt; d_gb &lt;&lt; &quot;// gearbox diameter [m] \n\n&quot;;<br />
outFile &lt;&lt; b_gb &lt;&lt; &quot;// gearbox width [m] \n\n&quot;;<br />
outFile &lt;&lt; m_sh &lt;&lt; &quot;// drive shaft weight [kg] \n\n&quot;;<br />
outFile &lt;&lt; m_psh1 &lt;&lt; &quot;// Fwd propfan shaft weight [kg] \n\n&quot;;<br />
outFile &lt;&lt; m_psh2 &lt;&lt; &quot;// Aft propfan shaft weight [kg] \n\n&quot;;<br />
outFile &lt;&lt; m_ges &lt;&lt; &quot;// Gesamtgewicht Gearbox + Shafts [kg] \n\n&quot;;<br />
outFile.close();</p>
<p>Ich kriege immer die folgende Fehlermeldung:</p>
<p>&quot;Gearbox.exe&quot;: &quot;C:\Windows\System32\ntdll.dll&quot; geladen, Cannot find or open the PDB file<br />
&quot;Gearbox.exe&quot;: &quot;C:\Windows\System32\kernel32.dll&quot; geladen, Cannot find or open the PDB file<br />
&quot;Gearbox.exe&quot;: &quot;C:\Windows\System32\KernelBase.dll&quot; geladen, Cannot find or open the PDB file</p>
<p>Kann mir bitte einer weiterhelfen. Ich weiss nicht weiter.</p>
<p>Vielen Dank für Eure Bemühungen / Hilfen!</p>
<p>Euer C++ - Laie,</p>
<p>GRK</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/289779/i-o-von-daten-double-aus-in-txt-files-anfängerlevel</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 22:54:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/289779.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Jul 2011 16:57:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 16:57:12 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>ich bin ein C++ Laie und muss kurzfristig eine .exe schreiben, dass auf eine Datei BGinput zugreift, die Daten (es sind Zeilenweise angeordnet 8 double - Variablen) einliest, berechnet und anschließend in einer anderen .txt ausgibt.</p>
<p>Zum Einlesen habe ich folgendes geschrieben, irgendwie klappts ned, kriege immer eine Fehlermeldung (s.u.)</p>
<p>int main(int argc, char* argv[]) {</p>
<p>double n_1;<br />
double n_sd;<br />
double n_2d;<br />
double P_sh;<br />
double d_max;<br />
double d_1i;<br />
double l_fwd;<br />
double l_aft;</p>
<p>ifstream inFile;<br />
inFile.open(&quot;GBinput.txt&quot;);<br />
if (inFile.fail()) {<br />
cerr &lt;&lt; &quot;unable to open file input.dat for reading&quot; &lt;&lt; endl;<br />
exit(1);<br />
}<br />
n_1=atof(argv[0]);<br />
n_sd=atof(argv[1]);<br />
n_2d=atof(argv[2]);<br />
P_sh=atof(argv[3]);<br />
d_max=atof(argv[4]);<br />
d_1i=atof(argv[5]);<br />
l_fwd=atof(argv[6]);<br />
l_aft=atof(argv[7]);</p>
<p>inFile.close();</p>
<p>Als Ausgabe habe ich folgendes geschrieben:</p>
<p>ofstream outFile;<br />
outFile.open(&quot;GBresults.txt&quot;);<br />
outFile &lt;&lt; d_gb &lt;&lt; &quot;// gearbox diameter [m] \n\n&quot;;<br />
outFile &lt;&lt; b_gb &lt;&lt; &quot;// gearbox width [m] \n\n&quot;;<br />
outFile &lt;&lt; m_sh &lt;&lt; &quot;// drive shaft weight [kg] \n\n&quot;;<br />
outFile &lt;&lt; m_psh1 &lt;&lt; &quot;// Fwd propfan shaft weight [kg] \n\n&quot;;<br />
outFile &lt;&lt; m_psh2 &lt;&lt; &quot;// Aft propfan shaft weight [kg] \n\n&quot;;<br />
outFile &lt;&lt; m_ges &lt;&lt; &quot;// Gesamtgewicht Gearbox + Shafts [kg] \n\n&quot;;<br />
outFile.close();</p>
<p>Ich kriege immer die folgende Fehlermeldung:</p>
<p>&quot;Gearbox.exe&quot;: &quot;C:\Windows\System32\ntdll.dll&quot; geladen, Cannot find or open the PDB file<br />
&quot;Gearbox.exe&quot;: &quot;C:\Windows\System32\kernel32.dll&quot; geladen, Cannot find or open the PDB file<br />
&quot;Gearbox.exe&quot;: &quot;C:\Windows\System32\KernelBase.dll&quot; geladen, Cannot find or open the PDB file</p>
<p>Kann mir bitte einer weiterhelfen. Ich weiss nicht weiter.</p>
<p>Vielen Dank für Eure Bemühungen / Hilfen!</p>
<p>Euer C++ - Laie,</p>
<p>GRK</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091946</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091946</guid><dc:creator><![CDATA[GRK]]></dc:creator><pubDate>Tue, 12 Jul 2011 16:57:12 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 17:18:25 GMT]]></title><description><![CDATA[<p>Erstens: Wozu öffnest du überhaupt die Datei, wenn du dann doch die Werte aus der Kommandzeile (argv) holst? (abgesehen davon ist zumindest argv[0] ziemlich sicher kein double-Wert)<br />
Zweitens: Die Meldungen, die du dort gepostet hast, sind harmlos. Das Konsolenfenster hat sich vermutlich kommentarlos beendet, nachdem es die Meldung über die fehlende Datei gebracht hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091950</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091950</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 12 Jul 2011 17:18:25 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 17:22:09 GMT]]></title><description><![CDATA[<p>Das sind nicht die richtigen Fehlermeldungen.<br />
Dein Programm öffnet zwar die Datei &quot;GBinput.txt&quot;, aber liest nicht aus ihr. Weißt du überhaupt wozu argc/argv gut sind?</p>
<p>PS:<br />
Wir haben hier C/C++ Tags.</p>
<p>Probier mal</p>
<pre><code class="language-cpp">int main()
{
  ifstream infile(&quot;GBinput.txt&quot;);
  vector&lt;double&gt; buf(8);
  for (size_t i = 0; i &lt; 8; ++i)
    infile &gt;&gt; buf[i];

  // Berechnungen

  ofstream outfile(&quot;GBresults.txt&quot;);
  // Ausgabe
}
</code></pre>
<p>Fehlerbehandlung natürlich noch einbauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091953</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Tue, 12 Jul 2011 17:22:09 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 19:28:03 GMT]]></title><description><![CDATA[<p>Hallo cooky451,</p>
<p>dein Beispiel mit vector&lt;double&gt; buf (8) kriege ich nicht zum laufen.</p>
<p>Ich habe #include &lt;vector&gt; ergänzt. Habe die Pfade der Dateien sichergestellt. Aber das Programm will die Daten nicht lesen. (habe dies überprüft).</p>
<p>Also ganz konkret: Meine textdatei schaut so aus:</p>
<p>Wert 1<br />
Wert 2<br />
Wert 3<br />
...<br />
(alles double-Werte; Zeilenweise angeordnet)</p>
<p>Warum liest mir das Programm die Daten nicht ein. Muss die Datei nicht vielleicht doch erst geöffnet werden?</p>
<p>Vielen Dank für die Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2092009</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2092009</guid><dc:creator><![CDATA[GRK]]></dc:creator><pubDate>Tue, 12 Jul 2011 19:28:03 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 19:30:52 GMT]]></title><description><![CDATA[<p>GRK schrieb:</p>
<blockquote>
<p>Aber das Programm will die Daten nicht lesen. (habe dies überprüft).</p>
</blockquote>
<p>Und wie?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2092011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2092011</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 12 Jul 2011 19:30:52 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 19:47:46 GMT]]></title><description><![CDATA[<p>ich habe gleich nach</p>
<p>int main()<br />
{<br />
ifstream infile(&quot;GBinput.txt&quot;);<br />
vector&lt;double&gt; buf(8);<br />
for (size_t i = 0; i &lt; 8; ++i)<br />
infile &gt;&gt; buf[i];</p>
<p>eine ausgabe machen lassen mittels cout &lt;&lt; buf[z.B. 3]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2092016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2092016</guid><dc:creator><![CDATA[GRK]]></dc:creator><pubDate>Tue, 12 Jul 2011 19:47:46 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 20:11:29 GMT]]></title><description><![CDATA[<p>Führ dies hier mal aus:</p>
<pre><code class="language-cpp">#include &lt;vector&gt;
#include &lt;fstream&gt;
#include &lt;iostream&gt;

using namespace std;

int main()
{
  ifstream infile(&quot;GBinput.txt&quot;);
  if (infile)
    {
      vector&lt;double&gt; buf(8);
      for (size_t i = 0; i &lt; 8; ++i)
        {
          infile &gt;&gt; buf[i];
          if (infile)
            cout &lt;&lt; &quot;Erfolgreich gelesen: &quot; &lt;&lt; buf[i] &lt;&lt; '\n';
          else
            {
              cout &lt;&lt; &quot;Fehler beim Lesen\n&quot;;
              break;
            }
        }
    }
  else
    cout &lt;&lt; &quot;Fehler beim Öffnen\n&quot;;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2092021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2092021</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 12 Jul 2011 20:11:29 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 20:42:01 GMT]]></title><description><![CDATA[<p>Danke seppj, du Fuchs!</p>
<p>Ordner waren im überraschend falschen Verzeichnis.</p>
<p>Jetzt noch eine letzte Frage,</p>
<p>das einlesen funktioniert jetzt. Das Auslesen aber nicht. Hab ich es geschafft in den 2 folgenden Zeilen was falsch zu machen oder muss man irgendwo nachschauen, dass der Pfad der einzulesenden Datei nicht gleich ist dem der auszulesenden?</p>
<p>ofstream outFile (&quot;GBresults.txt&quot;);<br />
outFile &lt;&lt; variable &lt;&lt; &quot;bisserl Tesxt \n\n&quot;;</p>
<p>Danke schon mal für die tatkräftige Unterstzützung!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2092041</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2092041</guid><dc:creator><![CDATA[GRK]]></dc:creator><pubDate>Tue, 12 Jul 2011 20:42:01 GMT</pubDate></item><item><title><![CDATA[Reply to I&#x2F;O von Daten (double) aus&#x2F;in .txt-files - Anfängerlevel on Tue, 12 Jul 2011 20:44:21 GMT]]></title><description><![CDATA[<p>Auch das hat sich geklärt!</p>
<p>Besten Dank für Euer aller Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2092042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2092042</guid><dc:creator><![CDATA[GRK]]></dc:creator><pubDate>Tue, 12 Jul 2011 20:44:21 GMT</pubDate></item></channel></rss>