<?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[Integer aus Textdatei]]></title><description><![CDATA[<p>Ich habe eine Textdatei, in der ein einzelner Wert steht(in diesem Fall 1).<br />
Wie erreiche ich, dass ich diese Zahl aus der Datei in eine IntegerVaraible bekomme? Ich habe foglendes versucht:</p>
<pre><code>fstream f;
f.open(&quot;test.txt&quot;, ios::out|ios::in);
f&gt;&gt;Test;   f.close();
	iTest=(int)Test;
	if (iTest==1)
	{MessageBox(NULL,&quot;1&quot;,0,0);
	}
	else{
		MessageBox(NULL,&quot;Leider nicht!&quot;,0,0);
</code></pre>
<p>fstream ist eingebunden. Und (sonst würde ich ja nciht fragen) es kommt eine MessageBox mit Leider nicht als Text. Ich hoffe jemand fällt eine Lösung ein. Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/206296/integer-aus-textdatei</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 06:04:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/206296.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 23 Feb 2008 11:57:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Integer aus Textdatei on Sat, 23 Feb 2008 11:57:03 GMT]]></title><description><![CDATA[<p>Ich habe eine Textdatei, in der ein einzelner Wert steht(in diesem Fall 1).<br />
Wie erreiche ich, dass ich diese Zahl aus der Datei in eine IntegerVaraible bekomme? Ich habe foglendes versucht:</p>
<pre><code>fstream f;
f.open(&quot;test.txt&quot;, ios::out|ios::in);
f&gt;&gt;Test;   f.close();
	iTest=(int)Test;
	if (iTest==1)
	{MessageBox(NULL,&quot;1&quot;,0,0);
	}
	else{
		MessageBox(NULL,&quot;Leider nicht!&quot;,0,0);
</code></pre>
<p>fstream ist eingebunden. Und (sonst würde ich ja nciht fragen) es kommt eine MessageBox mit Leider nicht als Text. Ich hoffe jemand fällt eine Lösung ein. Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1461396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1461396</guid><dc:creator><![CDATA[Zorakh55]]></dc:creator><pubDate>Sat, 23 Feb 2008 11:57:03 GMT</pubDate></item><item><title><![CDATA[Reply to Integer aus Textdatei on Sat, 23 Feb 2008 12:12:59 GMT]]></title><description><![CDATA[<p>Von welchem Typ ist die Variable <code>Test</code> ? Warum ließt Du nicht direkt in einen Integer!?</p>
<pre><code class="language-cpp">std::fstream file( &quot;./test.txt&quot;, std::ios::in | std::ios::out );

if( !file ) {

    MessageBox( 0, L&quot;Datei konnte nicht geöffnet werden!&quot;, L&quot;Fehler:&quot;, MB_OK | MB_ICONEXCLAMATION );

} else {

    int test;

    if( !( file &gt;&gt; test ) ) {

        MessageBox( 0, L&quot;Es konnte nicht von der Datei gelesen werden!&quot;, L&quot;Fehler:&quot;, MB_OK | MB_ICONEXCLAMATION );	
    }

    file.close( );
}
</code></pre>
<p>greetz, Swordfish</p>
<p>BTW: Was hat Deine Frage mit der WinAPI zu tun? (Davon abgesehen, dass du Fehlermeldungen mit <code>MessageBox( )</code> ausgibst)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1461408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1461408</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sat, 23 Feb 2008 12:12:59 GMT</pubDate></item><item><title><![CDATA[Reply to Integer aus Textdatei on Sat, 23 Feb 2008 12:25:58 GMT]]></title><description><![CDATA[<p>Also ich habe jetzt:</p>
<pre><code class="language-cpp">using namespace std;
int WINAPI WinMain (HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpcmdline, int ncmdshow)
{
char Test;
int iTest;

fstream f;
f.open(&quot;test.txt&quot;, ios::out|ios::in);
f &gt;&gt; iTest;   
f.close();
	if (iTest==1)
	{MessageBox(NULL,&quot;1&quot;,0,0);
	}
	else{
		MessageBox(NULL,&quot;Leider nicht!&quot;,0,0);
	}
}
</code></pre>
<p>Das funktioniert aber immernoch cniht.. Ich bekomme immernoch ein Leider nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1461422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1461422</guid><dc:creator><![CDATA[Zorakh55]]></dc:creator><pubDate>Sat, 23 Feb 2008 12:25:58 GMT</pubDate></item><item><title><![CDATA[Reply to Integer aus Textdatei on Sat, 23 Feb 2008 12:26:03 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-18363.html" rel="nofollow">Jochen Kalmbach</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1461423</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1461423</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sat, 23 Feb 2008 12:26:03 GMT</pubDate></item><item><title><![CDATA[Reply to Integer aus Textdatei on Sat, 23 Feb 2008 12:58:32 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-206285-and-start-is-10-and-postdays-is-0-and-postorder-is-asc-and-highlight-is--and-printview-is-1-and-start-is-0.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-206285-and-start-is-10-and-postdays-is-0-and-postorder-is-asc-and-highlight-is--and-printview-is-1-and-start-is-0.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1461459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1461459</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Sat, 23 Feb 2008 12:58:32 GMT</pubDate></item><item><title><![CDATA[Reply to Integer aus Textdatei on Sat, 23 Feb 2008 13:10:16 GMT]]></title><description><![CDATA[<p>Zorakh55 schrieb:</p>
<blockquote>
<p>Das funktioniert aber immernoch cniht.. Ich bekomme immernoch ein Leider nicht</p>
</blockquote>
<p>&quot;Funktioniert nicht&quot; ist keine Fehlerbeschreibung! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> <a href="http://catb.org/~esr/faqs/smart-questions.html" rel="nofollow">How To Ask Questions The Smart Way</a></p>
<p>Wird die Datei denn geöffnet?</p>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1461471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1461471</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sat, 23 Feb 2008 13:10:16 GMT</pubDate></item></channel></rss>