<?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[Fgets]]></title><description><![CDATA[<p>Hey!!<br />
Möchte gerne den Inhalt eines Files auf einen String schreiben. Benutze dafür fgets. Nur das herrschende Problem ist, dass meine Daten in diesem externen File alle durch '\n' getrennt sind. Wie löste ich mein Problem??<br />
Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/135502/fgets</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 00:15:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/135502.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Feb 2006 15:51:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 15:51:36 GMT]]></title><description><![CDATA[<p>Hey!!<br />
Möchte gerne den Inhalt eines Files auf einen String schreiben. Benutze dafür fgets. Nur das herrschende Problem ist, dass meine Daten in diesem externen File alle durch '\n' getrennt sind. Wie löste ich mein Problem??<br />
Thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984103</guid><dc:creator><![CDATA[LoD]]></dc:creator><pubDate>Thu, 02 Feb 2006 15:51:36 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 15:54:33 GMT]]></title><description><![CDATA[<p>aus einer textdatei?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984106</guid><dc:creator><![CDATA[txt?]]></dc:creator><pubDate>Thu, 02 Feb 2006 15:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 15:55:51 GMT]]></title><description><![CDATA[<p>Die einfachste Möglichkeit wäre wohl das komplette File auf einmal zu lesen</p>
<pre><code class="language-cpp">fseek(datei, 0, 2); // ans ende
long groesse = ftell(datei);
fseek(datei, 0, 0); // an den anfang
char *puffer = new char[groesse];
fread(puffer, 1, groesse, datei);
</code></pre>
<p>Hat aber mit C++ nicht sooo viel zu tun (ausser die Speicherallokierung)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984111</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984111</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 02 Feb 2006 15:55:51 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 17:12:12 GMT]]></title><description><![CDATA[<p>ja, aus einer Textdatei.<br />
Deine Lösung scheint ja recht schön und gut zu sein, aber ich habe die Befehle net zur verfügung. Ich habe nur standartdingssachen aus 1,5jahren unterricht zur verfügung... nix extravergantes. nur basiswissen.... leider</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984225</guid><dc:creator><![CDATA[LoD]]></dc:creator><pubDate>Thu, 02 Feb 2006 17:12:12 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 17:57:25 GMT]]></title><description><![CDATA[<p>LoD schrieb:</p>
<blockquote>
<p>ja, aus einer Textdatei.<br />
Deine Lösung scheint ja recht schön und gut zu sein, aber ich habe die Befehle net zur verfügung. Ich habe nur standartdingssachen aus 1,5jahren unterricht zur verfügung... nix extravergantes. nur basiswissen.... leider</p>
</blockquote>
<p>Und wie öffnest du Dateien?</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984267</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Thu, 02 Feb 2006 17:57:25 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 19:23:32 GMT]]></title><description><![CDATA[<p>Also das sind drei Standard-C Dateibefehle <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Und statt new kann man in C auch malloc nehmen, vielleicht kennt ihr das...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984370</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 02 Feb 2006 19:23:32 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 19:47:01 GMT]]></title><description><![CDATA[<p>[/quote]<br />
Und wie öffnest du Dateien?</p>
<p>mfg.[/quote]</p>
<p>dateien öffnen via: interner_Filename=fopen(&quot;dateipfad&quot;, &quot;verwendungsart&quot;);</p>
<p>und für die Datei auf einen String zu schreiben, muss ich fgets verwenden und genau deswegen stecke ich in der zwickmühle, weil ja fgets nur solange einliest, bis '\n' kommt und meine datensätze aus meiner textdatei sind alle durch '\n' voneinander getrennt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984408</guid><dc:creator><![CDATA[LoD]]></dc:creator><pubDate>Thu, 02 Feb 2006 19:47:01 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 19:59:04 GMT]]></title><description><![CDATA[<p>schon mal was von meher dimensionalen arrays gehört..??<br />
z.B. bei main(int argc, char **argv)<br />
reicht der tipp??<br />
p.s. ich lern erst seit nem halbern jahr c/c++<br />
und daher sollten deine 1.5 jahre kein prob sei ich hab erst 1/3 solangw erfahrung</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984432</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984432</guid><dc:creator><![CDATA[ICH_BIN_ES]]></dc:creator><pubDate>Thu, 02 Feb 2006 19:59:04 GMT</pubDate></item><item><title><![CDATA[Reply to Fgets on Thu, 02 Feb 2006 19:59:29 GMT]]></title><description><![CDATA[<p>Ahja... mein Programm sieht zZ so aus</p>
<p>char txt[20];<br />
FILE *out;</p>
<p>if((out=fopen(pfad, &quot;r&quot;)) == NULL)<br />
fprintf(stderr, &quot;\nDatei konnte nicht geöffnet werden.&quot;);</p>
<p>else<br />
{<br />
if(fgets(txt, 20, out)!=NULL)<br />
printf(&quot;\n\nDer Inhalt lautet: %s &quot;,txt);<br />
}</p>
<p>Aber der Inhalt meiner zu öffnenden Datei ist aber:<br />
<strong>April<br />
Dorothe<br />
Ellen<br />
Gelilah<br />
Keira<br />
Madison<br />
Penelope<br />
Rose<br />
Serena<br />
Summer</strong></p>
<p>und ich kriege nur &quot;<strong>April</strong>&quot; für mein printf(&quot;Text, %s&quot;, txt);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984435</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984435</guid><dc:creator><![CDATA[LoD]]></dc:creator><pubDate>Thu, 02 Feb 2006 19:59:29 GMT</pubDate></item></channel></rss>