<?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[C-String]]></title><description><![CDATA[<p>hallo</p>
<p>ich hab ein buch von jürgen wolf wo geschrieben steht:</p>
<p>char vname[30];<br />
cin.getline(vname,sizeof(vname));</p>
<p>sollte man nicht eher schreiben</p>
<p>cin.getline(vname,sizeof(vname)-1);</p>
<p>da man so eher vor pufferüberlauf geschützt ist. Also wegen der Nullterminierung.</p>
<p>was meint ihr??<br />
mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/200779/c-string</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 04:09:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/200779.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Dec 2007 17:42:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C-String on Wed, 19 Dec 2007 17:42:36 GMT]]></title><description><![CDATA[<p>hallo</p>
<p>ich hab ein buch von jürgen wolf wo geschrieben steht:</p>
<p>char vname[30];<br />
cin.getline(vname,sizeof(vname));</p>
<p>sollte man nicht eher schreiben</p>
<p>cin.getline(vname,sizeof(vname)-1);</p>
<p>da man so eher vor pufferüberlauf geschützt ist. Also wegen der Nullterminierung.</p>
<p>was meint ihr??<br />
mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1423359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1423359</guid><dc:creator><![CDATA[BOSS]]></dc:creator><pubDate>Wed, 19 Dec 2007 17:42:36 GMT</pubDate></item><item><title><![CDATA[Reply to C-String on Wed, 19 Dec 2007 18:40:21 GMT]]></title><description><![CDATA[<p>Nein, das passt schon. Das liest nur 29 Zeichen und schreibt an letzter Stelle die '\0'. Der Rest bleibt im Eingabepuffer hängen.</p>
<p>Das ist aber C++, ich verschiebe...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1423381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1423381</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 19 Dec 2007 18:40:21 GMT</pubDate></item><item><title><![CDATA[Reply to C-String on Wed, 19 Dec 2007 18:40:38 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-14811.html" rel="nofollow">Tim</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-10.html" rel="nofollow">ANSI C</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/1423382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1423382</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 19 Dec 2007 18:40:38 GMT</pubDate></item><item><title><![CDATA[Reply to C-String on Fri, 21 Dec 2007 09:46:51 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">char name[30];
std::cin.getline(name, 30, '\n');
</code></pre>
<p>Das ist korrekt, da der Parameter von getline nicht, wie bei den C-Standard-Funktionen oftmals, die Länge ohne Nullterminierungszeichen haben will.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424291</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 21 Dec 2007 09:46:51 GMT</pubDate></item></channel></rss>