<?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[Txt.Datei allgemin erstellen]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich möchte in ein normales C++ programm eine .txt Datei erstellen, dort was reinschrreiben, von dort lesen, den text drin bearbeiten...<br />
Ich hatte mit C was gemacht</p>
<pre><code class="language-cpp">:
	fp=fopen(&quot;text.txt&quot;,&quot;w&quot;);
	if(fp!=0)
		{
			fprintf(fp,&quot;%d&quot;,punkte);
			fclose(fp);
		}
</code></pre>
<p>kann ich es mit C++ einfacher erstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/147606/txt-datei-allgemin-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 05:39:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147606.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 May 2006 14:23:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 14:23:54 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich möchte in ein normales C++ programm eine .txt Datei erstellen, dort was reinschrreiben, von dort lesen, den text drin bearbeiten...<br />
Ich hatte mit C was gemacht</p>
<pre><code class="language-cpp">:
	fp=fopen(&quot;text.txt&quot;,&quot;w&quot;);
	if(fp!=0)
		{
			fprintf(fp,&quot;%d&quot;,punkte);
			fclose(fp);
		}
</code></pre>
<p>kann ich es mit C++ einfacher erstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1060213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060213</guid><dc:creator><![CDATA[delikanli]]></dc:creator><pubDate>Thu, 18 May 2006 14:23:54 GMT</pubDate></item><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 14:26:27 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>siehe <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39469.html" rel="nofollow">FAQ</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1060221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060221</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 18 May 2006 14:26:27 GMT</pubDate></item><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 14:27:01 GMT]]></title><description><![CDATA[<p>delikanli schrieb:</p>
<blockquote>
<p>Hallo,</p>
<p>Ich möchte in ein normales C++ programm eine .txt Datei erstellen, dort was reinschrreiben, von dort lesen, den text drin bearbeiten...<br />
Ich hatte mit C was gemacht</p>
<pre><code class="language-cpp">:

//ins txt.Datei schreiben
	void setPunkte(int punkte)
{

          FILE *fp;
	fp=fopen(&quot;text.txt&quot;,&quot;w&quot;);
	if(fp!=0)
		{
			fprintf(fp,&quot;%d&quot;,punkte);
			fclose(fp);
		}

}

//aus text.datei lesen
int getName(char *name)
{
	FILE *fp;
	fp=fopen(&quot;text.txt&quot;,&quot;r&quot;);
	if(fp!=0)
		{	fgets(name,MAX,fp);
			fclose(fp);
		}
	return 0;

}
</code></pre>
<p>kann ich es mit C++ einfacher erstellen?</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1060222</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060222</guid><dc:creator><![CDATA[delikanli]]></dc:creator><pubDate>Thu, 18 May 2006 14:27:01 GMT</pubDate></item><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 15:01:06 GMT]]></title><description><![CDATA[<p>also ich habe es angeschaut und ausprobiert.<br />
Aber die Txt. datei speichert die Daten komisch:<br />
ali ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌg ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ efr ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌw ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ</p>
<p>aber ich möchte es so abspeichern:</p>
<p>testperson,76<br />
testperson2,34</p>
<p>usw..</p>
<p>hier ist mein Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

struct PERSON 
{ 
    char VorName[20]; 
    char NachName[20]; 
    int TelNr; 
};

void main(){
// fstream damit die Datei zuerst schreibend und dann lesend geöffnet werden kann. 
fstream File(&quot;Person.txt&quot;, ios::out|ios::binary); 
if (File.is_open()) 
{ 
    // Nur zwei Datensätze schreiben. 
    // Hier wäre eine Fehlerprüfung angebracht 
    for (int i = 0; i &lt; 2 ; ++i) 
    { 
        PERSON Pers; 
        cout &lt;&lt; &quot;Vorname: &quot;; 
        cin &gt;&gt; Pers.VorName; 
        cout &lt;&lt; &quot;Nachname: &quot;; 
        cin &gt;&gt; Pers.NachName; 
        cout &lt;&lt; &quot;TelNr: &quot;; 
        cin &gt;&gt; Pers.TelNr; 

        // Aktuelle Person in der Datei speichern. 
        File.write((const char*)&amp;Pers, sizeof(Pers)); 
    } 
    File.close();   // Datei schließen 
} 
// Datei zum Lesen öffnen. 
File.open(&quot;Person.txt&quot;, ios::in|ios::binary); 
if (File.is_open()) 
{ 
    PERSON Pers; 
    while (File.read((char*)&amp;Pers, sizeof(Pers))) 
        cout &lt;&lt; Pers.VorName &lt;&lt; &quot; &quot; &lt;&lt; Pers.NachName &lt;&lt; &quot; &quot; &lt;&lt; Pers.TelNr &lt;&lt; endl; 
} 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1060248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060248</guid><dc:creator><![CDATA[delikanli]]></dc:creator><pubDate>Thu, 18 May 2006 15:01:06 GMT</pubDate></item><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 15:17:57 GMT]]></title><description><![CDATA[<p>Lass mal das ios::binary weg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1060256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060256</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 18 May 2006 15:17:57 GMT</pubDate></item><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 15:24:00 GMT]]></title><description><![CDATA[<p>nein es hat nicht geklappt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1060259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060259</guid><dc:creator><![CDATA[delikanli]]></dc:creator><pubDate>Thu, 18 May 2006 15:24:00 GMT</pubDate></item><item><title><![CDATA[Reply to Txt.Datei allgemin erstellen on Thu, 18 May 2006 15:30:57 GMT]]></title><description><![CDATA[<p>Wenn du Textausgaben haben willst darfst du nicht write verwenden. Eher sowas</p>
<pre><code class="language-cpp">File &lt;&lt; Pers.VorName;
File &lt;&lt; Pers.NachName;
File &lt;&lt; Pers.TelNr;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1060260</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1060260</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 18 May 2006 15:30:57 GMT</pubDate></item></channel></rss>