<?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 erstellen!]]></title><description><![CDATA[<p>Also ich habe im Internet gesucht, wie ich eine txt.datei erstellen und lesen kann. Zum erstellen reicht dieser code, doch wie kann ich eine txt datei mit dem namen eines &quot;char&quot; erstellen?</p>
<pre><code class="language-cpp">// using ofstream constructors.
#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

int main () {

ofstream outfile (&quot;test.txt&quot;);

// &gt;&gt; i/o operations here &lt;&lt;

outfile.close();

  return 0;
}
</code></pre>
<p>Also dass das z.B so aussieht, funktioniert jedoch nicht, da er ein Problem hat, dass schuler ein string ist.</p>
<pre><code class="language-cpp">#include &lt;stdafx.h&gt;
#include &lt;fstream&gt;
#include &lt;iostream&gt;

using namespace std;
char schuler[80];

int main()
{
	cin &gt;&gt; schuler;

	ofstream outfile (schuler&quot;.txt&quot;);
	outfile.close();

}
</code></pre>
<p>Ich hoffe Ihr versteht was ich haben will, und ich hoffe ihr könnt mir eine Antwort geben. Danke schon mal vorweg.</p>
<p>MFG: DerLateinProfi</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/175380/txt-datei-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 22:23:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/175380.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Mar 2007 18:29:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to txt.Datei erstellen! on Fri, 09 Mar 2007 18:29:06 GMT]]></title><description><![CDATA[<p>Also ich habe im Internet gesucht, wie ich eine txt.datei erstellen und lesen kann. Zum erstellen reicht dieser code, doch wie kann ich eine txt datei mit dem namen eines &quot;char&quot; erstellen?</p>
<pre><code class="language-cpp">// using ofstream constructors.
#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

int main () {

ofstream outfile (&quot;test.txt&quot;);

// &gt;&gt; i/o operations here &lt;&lt;

outfile.close();

  return 0;
}
</code></pre>
<p>Also dass das z.B so aussieht, funktioniert jedoch nicht, da er ein Problem hat, dass schuler ein string ist.</p>
<pre><code class="language-cpp">#include &lt;stdafx.h&gt;
#include &lt;fstream&gt;
#include &lt;iostream&gt;

using namespace std;
char schuler[80];

int main()
{
	cin &gt;&gt; schuler;

	ofstream outfile (schuler&quot;.txt&quot;);
	outfile.close();

}
</code></pre>
<p>Ich hoffe Ihr versteht was ich haben will, und ich hoffe ihr könnt mir eine Antwort geben. Danke schon mal vorweg.</p>
<p>MFG: DerLateinProfi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242485</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242485</guid><dc:creator><![CDATA[DerLateinProfi]]></dc:creator><pubDate>Fri, 09 Mar 2007 18:29:06 GMT</pubDate></item><item><title><![CDATA[Reply to txt.Datei erstellen! on Fri, 09 Mar 2007 19:47:04 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">char acDateiname[50]=&quot;Schueler&quot;;

strcat(acDateiname,&quot;.txt&quot;);

ofstream outfile (acDateiname);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1242559</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242559</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Fri, 09 Mar 2007 19:47:04 GMT</pubDate></item><item><title><![CDATA[Reply to txt.Datei erstellen! on Fri, 09 Mar 2007 19:53:06 GMT]]></title><description><![CDATA[<p>Nanana dünnpfiff ^^</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt; // für std::string und std::getline
#include &lt;fstream&gt;

int main() 
{
    std::cout &lt;&lt; &quot;Die zu oeffnende Datei angeben: &quot; &lt;&lt; std::flush;
    std::string string_filename; // ein dynamischer char array... sozusagen ;)
    std::getline(std::cin, string_filename);
    std::ofstream file_stream(string_filename.c_str(), std::ios::out);
    if (file_stream.is_open() == false || file_stream.good() == false) // gucken ob er die Datei anständig geöffnet hat ...
        return 1;
// &gt;&gt; i/o operations here &lt;&lt;

    file_stream.close();

    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1242563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242563</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 09 Mar 2007 19:53:06 GMT</pubDate></item><item><title><![CDATA[Reply to txt.Datei erstellen! on Sat, 10 Mar 2007 12:46:03 GMT]]></title><description><![CDATA[<p>Ich danke ihnen sehr, meine Herren. Ich habe mich für die erste Methode entschieden. Und es funktioniert bestens.</p>
<p>MFG: DerLateinProfi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1242812</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1242812</guid><dc:creator><![CDATA[DerLateinProfi]]></dc:creator><pubDate>Sat, 10 Mar 2007 12:46:03 GMT</pubDate></item></channel></rss>