<?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[sizeof von string hinter pointer?]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wie bekomme ich die Größe eines Strings raus, wenn ich nur den Pointer kenne?<br />
strlen(ptr_string) gibt mir die korrekte stringlänge zurück, aber sizeof(ptr_string) gibt immer nur 4 zurück...</p>
<p>char cstring[11];<br />
char *ptr_string=cstring;</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/151325/sizeof-von-string-hinter-pointer</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 10:15:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/151325.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 Jun 2006 10:04:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:04:31 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wie bekomme ich die Größe eines Strings raus, wenn ich nur den Pointer kenne?<br />
strlen(ptr_string) gibt mir die korrekte stringlänge zurück, aber sizeof(ptr_string) gibt immer nur 4 zurück...</p>
<p>char cstring[11];<br />
char *ptr_string=cstring;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084955</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084955</guid><dc:creator><![CDATA[spooky]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:04:31 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:06:42 GMT]]></title><description><![CDATA[<p>sizeof gibt dir hier ja auch nur die Größe des Pointers zurück, und der ist auf 32-Bit Systemen so gut wie immer 4 Byte groß.<br />
Benutz doch einfach strlen, wo ist das Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084958</guid><dc:creator><![CDATA[michba]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:06:42 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:07:32 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Beantwortest du die Frage nicht selber?</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084961</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:07:32 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:17:08 GMT]]></title><description><![CDATA[<p>nee ihr habt mich falsch verstanden...</p>
<p>ich habe einen String, auf diesen lese ich mit scanf was ein. danach übergebe ich diesen als zeiger an eine funktion. in dieser soll geprüft werden ob die eingabe länger als der definierte string ist. wenn die eingabe länger war als 10 zeichen (string ist hier 10+1) dann muss die Eingabe wiederholt werden, sonst schiest der string ja im speicher drüber hinaus.</p>
<p>if(strlen(ptr_string) &gt; sizeof(ptr_string)) ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084967</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084967</guid><dc:creator><![CDATA[spooky]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:17:08 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:24:25 GMT]]></title><description><![CDATA[<p>spooky schrieb:</p>
<blockquote>
<p>nee ihr habt mich falsch verstanden...</p>
<p>ich habe einen String, auf diesen lese ich mit scanf was ein. danach übergebe ich diesen als zeiger an eine funktion. in dieser soll geprüft werden ob die eingabe länger als der definierte string ist. wenn die eingabe länger war als 10 zeichen (string ist hier 10+1) dann muss die Eingabe wiederholt werden, sonst schiest der string ja im speicher drüber hinaus.</p>
<p>if(strlen(ptr_string) &gt; sizeof(ptr_string)) ...</p>
</blockquote>
<p>Dir ist schon klar, dass das Kind zu diesem Zeitpunkt längst in den Brunnen gefallen ist, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084974</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:24:25 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:25:44 GMT]]></title><description><![CDATA[<p>und wie kann man es besser machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084975</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084975</guid><dc:creator><![CDATA[spooky]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:25:44 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:27:22 GMT]]></title><description><![CDATA[<p>wenn du mit scanf() einen String einliest und der eingegebene String größer ist, als der Speicher, der zur Verfügung steht, &quot;schießt&quot; du schon beim einlesen darüber hinaus.</p>
<p>Du willst sicher fgets()</p>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084978</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084978</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:27:22 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:34:36 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Da du im C++-Forum schreibst, solltest du einfach std::string benutzen.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084985</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:34:36 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:44:47 GMT]]></title><description><![CDATA[<p>yup, danke swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084991</guid><dc:creator><![CDATA[spooky]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:44:47 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:53:32 GMT]]></title><description><![CDATA[<p>chrische5 schrieb:</p>
<blockquote>
<p>Da du im C++-Forum schreibst, solltest du einfach std::string benutzen.</p>
</blockquote>
<p>Jo, schon, wenn er schon eine Frage hat, welche auf C-Strings abziehlt darf man ihm doch auch im C++-Forum helfen...</p>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084994</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:53:32 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 10:56:28 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Swordfish schrieb:</p>
<blockquote>
<p>chrische5 schrieb:</p>
<blockquote>
<p>Da du im C++-Forum schreibst, solltest du einfach std::string benutzen.</p>
</blockquote>
<p>Jo, schon, wenn er schon eine Frage hat, welche auf C-Strings abziehlt darf man ihm doch auch im C++-Forum helfen...</p>
<p>Greetz, Swordfish</p>
</blockquote>
<p>Na klar. Ich habe erst seine Frage nich verstanden und habe aus seinem ersten Post nur herauslesen könne, dass er sich die Frage eigentlich selber beantwortet und dann wollte ich ihn darauf hinweisen, dass es bei c++ std::string gibt. Das sollte nur eine Information sein und nicht bedeuten, dass es sich mit seiner Frage ins c-forum verpissen soll, weil ihm hier keiner antwortet.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084996</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084996</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:56:28 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 11:14:14 GMT]]></title><description><![CDATA[<p>In C++ wollen wir:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main()
{
  char str[ 10 ];

  std::cout &lt;&lt; &quot;Namen eingeben: &quot;;
  std::cin &gt;&gt; std::width( 10 ) &gt;&gt; str;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1085010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085010</guid><dc:creator><![CDATA[Ne so nicht!]]></dc:creator><pubDate>Sun, 25 Jun 2006 11:14:14 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 11:17:18 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Und warum nicht einfach:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
std::string Name;
std::cout&lt;&lt;&quot;Bitte Namen eingeben&quot;&lt;&lt;std::endl;
std::cin&gt;&gt;Name;

}
</code></pre>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085012</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 25 Jun 2006 11:17:18 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 11:27:08 GMT]]></title><description><![CDATA[<p>Dann ist die Eingabe aber nicht begrenzt und vllt. will er ja gar keine längere Eingabe oder es ist gar keine längere möglich. Da müsst man jetzt schon wissen was genau gewollt ist um zu wissen was besser ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085018</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085018</guid><dc:creator><![CDATA[Ne so nicht!]]></dc:creator><pubDate>Sun, 25 Jun 2006 11:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to sizeof von string hinter pointer? on Sun, 25 Jun 2006 11:30:57 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ne so nicht! schrieb:</p>
<blockquote>
<p>Dann ist die Eingabe aber nicht begrenzt und vllt. will er ja gar keine längere Eingabe oder es ist gar keine längere möglich. Da müsst man jetzt schon wissen was genau gewollt ist um zu wissen was besser ist.</p>
</blockquote>
<p>Es wäre allerdings kein Problem die Eingabe nun auf Länge zu testen.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085020</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 25 Jun 2006 11:30:57 GMT</pubDate></item></channel></rss>