<?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[textdatei erstellen]]></title><description><![CDATA[<p>Ich hab ein Problem, ich möchte, dass das Programm eine texttdatei erstellt/öffnet deren Name in einer variable steht.<br />
Hier der Code:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
void main (void)
{
char dateiname[30]=&quot;hallo&quot;;
char txt[5]=&quot;.txt&quot;;
FILE *datei;  
strcat ( dateiname, txt );  
datei = fopen ( &quot;%s&quot;, &quot;w+&quot; ); 

printf(&quot;%s &quot;,dateiname);
}
</code></pre>
<p>Der Fehler ist, dass es bei der fopen zeile zu viele argumente gibt, kann mir da jemand helfen wie ich das machen kann?<br />
(strcat wird von mir als verkettungsoperator benutzt)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/159316/textdatei-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 10:41:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159316.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Sep 2006 20:16:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to textdatei erstellen on Wed, 13 Sep 2006 20:16:46 GMT]]></title><description><![CDATA[<p>Ich hab ein Problem, ich möchte, dass das Programm eine texttdatei erstellt/öffnet deren Name in einer variable steht.<br />
Hier der Code:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
void main (void)
{
char dateiname[30]=&quot;hallo&quot;;
char txt[5]=&quot;.txt&quot;;
FILE *datei;  
strcat ( dateiname, txt );  
datei = fopen ( &quot;%s&quot;, &quot;w+&quot; ); 

printf(&quot;%s &quot;,dateiname);
}
</code></pre>
<p>Der Fehler ist, dass es bei der fopen zeile zu viele argumente gibt, kann mir da jemand helfen wie ich das machen kann?<br />
(strcat wird von mir als verkettungsoperator benutzt)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1136944</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1136944</guid><dc:creator><![CDATA[gnom69]]></dc:creator><pubDate>Wed, 13 Sep 2006 20:16:46 GMT</pubDate></item><item><title><![CDATA[Reply to textdatei erstellen on Wed, 13 Sep 2006 20:49:44 GMT]]></title><description><![CDATA[<p>Dein Quelltext stinkt nach C. In C++ würde man das folgendermaßen machen:</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;fstream&gt;

int main()
{
    std::string dateiname = &quot;hallo&quot;;
    std::string txt = &quot;.txt&quot;;

    std::ofstream Stream ((dateiname + txt).c_str());

    Stream &lt;&lt; &quot;text, der in Datei geschrieben werden soll&quot;;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1136953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1136953</guid><dc:creator><![CDATA[Z2]]></dc:creator><pubDate>Wed, 13 Sep 2006 20:49:44 GMT</pubDate></item><item><title><![CDATA[Reply to textdatei erstellen on Wed, 13 Sep 2006 21:48:37 GMT]]></title><description><![CDATA[<blockquote>
<p>Dein Quelltext stinkt nach C.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
<p>trotzdem der fehler:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
int main ()                         // !!!
{
char dateiname[30]=&quot;hallo&quot;;
char txt[5]=&quot;.txt&quot;;
FILE *datei;  
strcat ( dateiname, txt );  
datei = fopen ( dateiname, &quot;w+&quot; );  // %s -&gt;? -&gt;funktioniert nicht wie printf

printf(&quot;%s &quot;,dateiname);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1136962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1136962</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 13 Sep 2006 21:48:37 GMT</pubDate></item><item><title><![CDATA[Reply to textdatei erstellen on Thu, 14 Sep 2006 11:58:39 GMT]]></title><description><![CDATA[<p>Der quelltext stinkt nach c, da ich von c auf c++ umgesprungen bin.</p>
<p>Aber so wie ihr es geschrieben habt funktioniert es Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1137233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1137233</guid><dc:creator><![CDATA[gnom69]]></dc:creator><pubDate>Thu, 14 Sep 2006 11:58:39 GMT</pubDate></item></channel></rss>