<?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[Zugriffs verletzung]]></title><description><![CDATA[<p>Moin, ich hab ein Problem mit folgendem Code</p>
<pre><code class="language-cpp">void erase_blanks(char *pos, char *end)
{
	for(char* i_pos = pos; i_pos != end; ++i_pos)
		if((*i_pos) == ' ')
			for(char* j_pos = i_pos; j_pos != (end-1); ++j_pos)
			{
				*j_pos = *(j_pos + 1); // Zugriffsverletzung!!
				end = end - 1;
			}
}
</code></pre>
<p>warum hab ich in Zeile 7 eine Zugriffsverletzung ?</p>
<p>MFG (H)er(r) Müdet</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/240623/zugriffs-verletzung</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 22:14:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/240623.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 May 2009 23:35:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zugriffs verletzung on Fri, 08 May 2009 23:35:22 GMT]]></title><description><![CDATA[<p>Moin, ich hab ein Problem mit folgendem Code</p>
<pre><code class="language-cpp">void erase_blanks(char *pos, char *end)
{
	for(char* i_pos = pos; i_pos != end; ++i_pos)
		if((*i_pos) == ' ')
			for(char* j_pos = i_pos; j_pos != (end-1); ++j_pos)
			{
				*j_pos = *(j_pos + 1); // Zugriffsverletzung!!
				end = end - 1;
			}
}
</code></pre>
<p>warum hab ich in Zeile 7 eine Zugriffsverletzung ?</p>
<p>MFG (H)er(r) Müdet</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1708002</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1708002</guid><dc:creator><![CDATA[(H)er(r) Müdet]]></dc:creator><pubDate>Fri, 08 May 2009 23:35:22 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriffs verletzung on Sat, 09 May 2009 00:05:45 GMT]]></title><description><![CDATA[<p>Mit dem Debugger hättest du die Antwort in einer halben Minute gefunden.</p>
<pre><code class="language-cpp">void erase_blanks(char *pos,char *end)
{
  for (char* i_pos=pos;i_pos!=end;++i_pos)
  {
    if ((*i_pos)==' ')
    {
      for (char* j_pos=i_pos;j_pos!=(end-1);++j_pos)
      {
        *j_pos=*(j_pos+1);
      }
      --end;
      --i_pos;
    }
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1708007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1708007</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Sat, 09 May 2009 00:05:45 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriffs verletzung on Sat, 09 May 2009 00:23:08 GMT]]></title><description><![CDATA[<p>Äh, ein konstantes string-Literal kannst du nicht ändern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1708010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1708010</guid><dc:creator><![CDATA[Konstant0r]]></dc:creator><pubDate>Sat, 09 May 2009 00:23:08 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriffs verletzung on Sat, 09 May 2009 00:51:03 GMT]]></title><description><![CDATA[<p>Danke!...stimmt die anpassung der äußeren schleife hab ich versaut... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
trotzdem besteht weiterhin das Prob. das er bei der Zeile</p>
<pre><code class="language-cpp">*j_pos = *(j_pos + 1);
</code></pre>
<p>meckert bzgl. einer Zugriffsverletzung.</p>
<p>Warum ist das ein Konstantes &quot;String-Literal&quot; ?<br />
Das ist doch nur ein Pointer, der wo hinzeigt, und ein String ist das doch<br />
nur weil irgentwo im folgenem Speicher iwo ein '\0' steht oder ???<br />
Solange ich kein const verwende sollte ich doch schreiben drüfen wo ich will oder ?</p>
<p>MFG (H)er(r) Müdet</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1708014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1708014</guid><dc:creator><![CDATA[(H)er(r) Müdet]]></dc:creator><pubDate>Sat, 09 May 2009 00:51:03 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriffs verletzung on Sat, 09 May 2009 02:16:36 GMT]]></title><description><![CDATA[<p>C++ Standard schrieb:</p>
<blockquote>
<p>An ordinary string literal has type &quot;array of n const char&quot; and static storage duration ...</p>
<p>...</p>
<p>Whether all string literals are distinct (that is, are stored in nonoverlapping objects) is implementation-defined. The effect of attempting to modify a string literal is undefined.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1708017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1708017</guid><dc:creator><![CDATA[Konstant0r]]></dc:creator><pubDate>Sat, 09 May 2009 02:16:36 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriffs verletzung on Sat, 09 May 2009 10:25:53 GMT]]></title><description><![CDATA[<p>Was ist jetzt mit dem Debugger? Er sagt dir genau, welche Werte die Variablen zum Zeit der Zugriffsverletzung haben.<br />
Ansonsten zeig mal die jetzige Funktion und wie du sie aufrufst.</p>
<p>Stringliterale sind kein Problem, diese kann man aus ebengenannten Gründen ohnehin nicht an die Funktion übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1708089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1708089</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Sat, 09 May 2009 10:25:53 GMT</pubDate></item></channel></rss>