<?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[Laufzeitfehler: Fehlermeldung Windows found a Breakpoint]]></title><description><![CDATA[<p>Folgender Auszug aus meinem Programm. (Ist ein kleines Multiplayergame basierend auf einer MySQL Datenbank)</p>
<pre><code class="language-cpp">char *qry = &quot;SELECT x,y FROM tabelle WHERE user = '&quot;;
	char *update = &quot;UPDATE tabelle SET &quot;;
	char *temps;                

...

		// Bewegunsroutine v1

		temps = new char[sizeof(qry)+benutzercl.size()+1];
		strcpy(temps,qry);
		strcat(temps,benutzercl.c_str());
		strcat(temps,&quot;'&quot;);

		mysql_real_query(my,temps,strlen(temps));
		results = mysql_store_result(my);
		row = mysql_fetch_row(results);
		delete [] temps;

		ax = atoi(row[0]);
		ay = atoi(row[1]);

		if(_kbhit) {
			eingabe = getch();
		}

		if(eingabe == 'w' || eingabe == 's') {

			temps = new char[sizeof(update)+4+sizeof(row[0])+15+benutzercl.size()+1];
			strcpy(temps,update);
			strcat(temps,&quot;y = '&quot;);

			if(eingabe == 'w') {
					ay++;
			}
			if(eingabe == 's') {
					ay--;
			}

			itoa(ay,row[0],10);
			strcat(temps,row[0]);

		} 
		if(eingabe == 'a' || eingabe == 'd') {

			temps = new char[sizeof(update)+4+sizeof(row[1])+15+benutzercl.size()+1];
			strcpy(temps,update);
			strcat(temps,&quot;x = '&quot;);

			if(eingabe == 'a') {
					ax++;
			}
			if(eingabe == 'd') {
					ax--;
			}

			itoa(ax,row[1],10);
			strcat(temps,row[1]);

		}

		strcat(temps,&quot;' WHERE user = '&quot;);
		strcat(temps,benutzercl.c_str());
		strcat(temps,&quot;'&quot;);

		mysql_real_query(my,temps,strlen(temps));
		delete [] temps;
</code></pre>
<p>Das Problem liegt hier bei den delete-Operatoren. Ich bin das Programm mit dem Debugger durchlaufen und immer gleich nach dem</p>
<pre><code class="language-cpp">delete [] temps;
</code></pre>
<p>Gibts eine Fehlermeldung zur Laufzeit:</p>
<blockquote>
<p>Windows has triggered a breakpoint in spiel.exe</p>
<p>This may be due to a corruption of the heap, which indicates a bug in spiel.exe or any of the DLLs it has loaded.</p>
<p>This may also be due to the user pressing F12 while spiel.exe has focus.</p>
<p>The output window may have more diagnostic information.</p>
</blockquote>
<p>Danke schon einmal im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/292965/laufzeitfehler-fehlermeldung-windows-found-a-breakpoint</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 14:04:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/292965.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Sep 2011 16:05:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Laufzeitfehler: Fehlermeldung Windows found a Breakpoint on Wed, 21 Sep 2011 16:05:21 GMT]]></title><description><![CDATA[<p>Folgender Auszug aus meinem Programm. (Ist ein kleines Multiplayergame basierend auf einer MySQL Datenbank)</p>
<pre><code class="language-cpp">char *qry = &quot;SELECT x,y FROM tabelle WHERE user = '&quot;;
	char *update = &quot;UPDATE tabelle SET &quot;;
	char *temps;                

...

		// Bewegunsroutine v1

		temps = new char[sizeof(qry)+benutzercl.size()+1];
		strcpy(temps,qry);
		strcat(temps,benutzercl.c_str());
		strcat(temps,&quot;'&quot;);

		mysql_real_query(my,temps,strlen(temps));
		results = mysql_store_result(my);
		row = mysql_fetch_row(results);
		delete [] temps;

		ax = atoi(row[0]);
		ay = atoi(row[1]);

		if(_kbhit) {
			eingabe = getch();
		}

		if(eingabe == 'w' || eingabe == 's') {

			temps = new char[sizeof(update)+4+sizeof(row[0])+15+benutzercl.size()+1];
			strcpy(temps,update);
			strcat(temps,&quot;y = '&quot;);

			if(eingabe == 'w') {
					ay++;
			}
			if(eingabe == 's') {
					ay--;
			}

			itoa(ay,row[0],10);
			strcat(temps,row[0]);

		} 
		if(eingabe == 'a' || eingabe == 'd') {

			temps = new char[sizeof(update)+4+sizeof(row[1])+15+benutzercl.size()+1];
			strcpy(temps,update);
			strcat(temps,&quot;x = '&quot;);

			if(eingabe == 'a') {
					ax++;
			}
			if(eingabe == 'd') {
					ax--;
			}

			itoa(ax,row[1],10);
			strcat(temps,row[1]);

		}

		strcat(temps,&quot;' WHERE user = '&quot;);
		strcat(temps,benutzercl.c_str());
		strcat(temps,&quot;'&quot;);

		mysql_real_query(my,temps,strlen(temps));
		delete [] temps;
</code></pre>
<p>Das Problem liegt hier bei den delete-Operatoren. Ich bin das Programm mit dem Debugger durchlaufen und immer gleich nach dem</p>
<pre><code class="language-cpp">delete [] temps;
</code></pre>
<p>Gibts eine Fehlermeldung zur Laufzeit:</p>
<blockquote>
<p>Windows has triggered a breakpoint in spiel.exe</p>
<p>This may be due to a corruption of the heap, which indicates a bug in spiel.exe or any of the DLLs it has loaded.</p>
<p>This may also be due to the user pressing F12 while spiel.exe has focus.</p>
<p>The output window may have more diagnostic information.</p>
</blockquote>
<p>Danke schon einmal im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2122175</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2122175</guid><dc:creator><![CDATA[daispro]]></dc:creator><pubDate>Wed, 21 Sep 2011 16:05:21 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeitfehler: Fehlermeldung Windows found a Breakpoint on Wed, 21 Sep 2011 16:11:32 GMT]]></title><description><![CDATA[<p>1. wieso - benutzt - du - C-Strings ? Das dann Probleme mit Speicherverwaltung aufkommen, ist doch vorprogrammiert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> ;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2122178</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2122178</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 21 Sep 2011 16:11:32 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeitfehler: Fehlermeldung Windows found a Breakpoint on Wed, 21 Sep 2011 16:14:14 GMT]]></title><description><![CDATA[<p>update und qry sind keine Arrays, sondern Zeiger - und da liefert sizeof() nicht den Wert, den du erwartest. Dadurch reservierst du weniger Speicher als zu eigentlich benötigst - und zerstörst dann bei den strcpy()-Aufrufen vermutlich wichtige Verwaltungsinformationen der Heap-Verwaltung. Wenn du die Länge der Strings wissen willst, brauchst du strlen().</p>
<p>Oder noch besser: Du verwendest gleich std::string anstelle mit nackten char-Zeigern zu hantieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2122180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2122180</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 21 Sep 2011 16:14:14 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeitfehler: Fehlermeldung Windows found a Breakpoint on Wed, 21 Sep 2011 16:19:10 GMT]]></title><description><![CDATA[<p>Danke für die schnelle Antwort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Ich werde dann Morgen noch mal alles auf std::string umschreiben. Schaff ich jetzt bzw heute leider nicht mehr. Werde dann aber auch hier nochmal meinen Erfahrungsbericht reinschreiben damit andere die das gleiche Problem haben eine Lösung sehen.</p>
<p>Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2122185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2122185</guid><dc:creator><![CDATA[daispro]]></dc:creator><pubDate>Wed, 21 Sep 2011 16:19:10 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeitfehler: Fehlermeldung Windows found a Breakpoint on Wed, 21 Sep 2011 16:41:06 GMT]]></title><description><![CDATA[<p>Nur rein aus Neugier: lernst du nur C oder C/C++? Ich hoffe nicht C++, denn dieser Beitrag gehört schon in das C-Forum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2122192</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2122192</guid><dc:creator><![CDATA[*Rewind*]]></dc:creator><pubDate>Wed, 21 Sep 2011 16:41:06 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeitfehler: Fehlermeldung Windows found a Breakpoint on Thu, 22 Sep 2011 16:39:13 GMT]]></title><description><![CDATA[<p>nach &quot;dem&quot; delete [] temps?<br />
Ich seh da zwei (Zeile 17 und 66).</p>
<p>Was CStoll gesagt hat ist wohl hauptsächlich das Problem, allerdings würds dir auch explodieren, wenn die Eingabe nicht w a s oder d ist. Kleiner fix dafür:</p>
<pre><code class="language-cpp">char *qry = &quot;SELECT x,y FROM tabelle WHERE user = '&quot;;
    char *update = &quot;UPDATE tabelle SET &quot;;
    char *temps;                

...

        // Bewegunsroutine v1

        temps = new char[sizeof(qry)+benutzercl.size()+1];
        strcpy(temps,qry);
        strcat(temps,benutzercl.c_str());
        strcat(temps,&quot;'&quot;);

        mysql_real_query(my,temps,strlen(temps));
        results = mysql_store_result(my);
        row = mysql_fetch_row(results);
        delete [] temps;

        ax = atoi(row[0]);
        ay = atoi(row[1]);

        if(_kbhit) {
            eingabe = getch();
        }

        if(eingabe == 'w' || eingabe == 's') {

            temps = new char[sizeof(update)+4+sizeof(row[0])+15+benutzercl.size()+1];
            strcpy(temps,update);
            strcat(temps,&quot;y = '&quot;);

            if(eingabe == 'w') {
                    ay++;
            }
            if(eingabe == 's') {
                    ay--;
            }

            itoa(ay,row[0],10);
            strcat(temps,row[0]);

        } else if(eingabe == 'a' || eingabe == 'd') {

            temps = new char[sizeof(update)+4+sizeof(row[1])+15+benutzercl.size()+1];
            strcpy(temps,update);
            strcat(temps,&quot;x = '&quot;);

            if(eingabe == 'a') {
                    ax++;
            }
            if(eingabe == 'd') {
                    ax--;
            }

            itoa(ax,row[1],10);
            strcat(temps,row[1]);

        } else {
            return; //musst dir eventuell überlegen, was du in einem solchen fall machen solltest, auf jedenfall NICHT weiter den code ausführen.
        }

        strcat(temps,&quot;' WHERE user = '&quot;);
        strcat(temps,benutzercl.c_str());
        strcat(temps,&quot;'&quot;);

        mysql_real_query(my,temps,strlen(temps));
        delete [] temps;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2122560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2122560</guid><dc:creator><![CDATA[kleiner Troll]]></dc:creator><pubDate>Thu, 22 Sep 2011 16:39:13 GMT</pubDate></item></channel></rss>