<?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[Speicherfehler]]></title><description><![CDATA[<p>Hallo,<br />
will ein Programm schreiben dass nur eine bestimmte Zahl von Linien in einem Bereich zulässt. Aber irgendwie funktioniert das nicht. Wenn bereits eine Linie gezeichnet wird kommt schon eine Fehlermeldung. Wäre nett wenn mir einer helfen könnte. Der Debugger hilft mir auch nicht.</p>
<p>Der Quellcode:</p>
<p>//In der Doc<br />
// Attribute<br />
public:<br />
CPoint m_punkte[100][2];<br />
int m_iAnzahl;<br />
void insertLinie (CPoint start, CPoint ende);</p>
<p>void CSDIDoc::insertLinie(CPoint start, CPoint ende)<br />
{<br />
if(m_iAnzahl&lt;100){<br />
m_punkte[m_iAnzahl][0] = start; // Zeigt Debugger als Fehler an<br />
m_punkte[m_iAnzahl][1] = ende; // Zeigt Debugger als Fehler an<br />
}<br />
else {<br />
AfxMessageBox(&quot;Kein Platz&quot;);<br />
}<br />
}</p>
<p>//In der View<br />
// Implementierung<br />
public:<br />
CPoint m_px[2];</p>
<p>void CSDIView::OnLButtonDblClk(UINT nFlags, CPoint point)<br />
// soll bei Doppelklick Punkte verbinden u. zeichnen</p>
<p>CClientDC dc(this);</p>
<p>if(m_px[0].x==0 &amp;&amp; m_px[0].y==0){<br />
m_px[0]=point;<br />
}<br />
else {<br />
m_px[1]=point;</p>
<p>dc.MoveTo(m_px[0]);<br />
dc.LineTo(m_px[1]);<br />
GetDocument()-&gt;insertLinie(m_px[0],m_px[1]);<br />
Invalidate();<br />
m_px[0].x=0;<br />
m_px[0].y=0;<br />
m_px[1].x=0;<br />
m_px[1].y=0;<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/157393/speicherfehler</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Jul 2026 22:02:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/157393.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Aug 2006 11:32:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Speicherfehler on Fri, 25 Aug 2006 11:32:10 GMT]]></title><description><![CDATA[<p>Hallo,<br />
will ein Programm schreiben dass nur eine bestimmte Zahl von Linien in einem Bereich zulässt. Aber irgendwie funktioniert das nicht. Wenn bereits eine Linie gezeichnet wird kommt schon eine Fehlermeldung. Wäre nett wenn mir einer helfen könnte. Der Debugger hilft mir auch nicht.</p>
<p>Der Quellcode:</p>
<p>//In der Doc<br />
// Attribute<br />
public:<br />
CPoint m_punkte[100][2];<br />
int m_iAnzahl;<br />
void insertLinie (CPoint start, CPoint ende);</p>
<p>void CSDIDoc::insertLinie(CPoint start, CPoint ende)<br />
{<br />
if(m_iAnzahl&lt;100){<br />
m_punkte[m_iAnzahl][0] = start; // Zeigt Debugger als Fehler an<br />
m_punkte[m_iAnzahl][1] = ende; // Zeigt Debugger als Fehler an<br />
}<br />
else {<br />
AfxMessageBox(&quot;Kein Platz&quot;);<br />
}<br />
}</p>
<p>//In der View<br />
// Implementierung<br />
public:<br />
CPoint m_px[2];</p>
<p>void CSDIView::OnLButtonDblClk(UINT nFlags, CPoint point)<br />
// soll bei Doppelklick Punkte verbinden u. zeichnen</p>
<p>CClientDC dc(this);</p>
<p>if(m_px[0].x==0 &amp;&amp; m_px[0].y==0){<br />
m_px[0]=point;<br />
}<br />
else {<br />
m_px[1]=point;</p>
<p>dc.MoveTo(m_px[0]);<br />
dc.LineTo(m_px[1]);<br />
GetDocument()-&gt;insertLinie(m_px[0],m_px[1]);<br />
Invalidate();<br />
m_px[0].x=0;<br />
m_px[0].y=0;<br />
m_px[1].x=0;<br />
m_px[1].y=0;<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1124325</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1124325</guid><dc:creator><![CDATA[Neuling3001]]></dc:creator><pubDate>Fri, 25 Aug 2006 11:32:10 GMT</pubDate></item><item><title><![CDATA[Reply to Speicherfehler on Fri, 25 Aug 2006 11:42:47 GMT]]></title><description><![CDATA[<p>Wo wird denn &quot;m_iAnzahl&quot; gesetzt ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1124338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1124338</guid><dc:creator><![CDATA[Cpp_Junky]]></dc:creator><pubDate>Fri, 25 Aug 2006 11:42:47 GMT</pubDate></item><item><title><![CDATA[Reply to Speicherfehler on Sat, 26 Aug 2006 11:39:37 GMT]]></title><description><![CDATA[<p>Soll m_iAnzahl auf 0 gesetzt werden oder ...?</p>
<p>Ich hab keine Ahnung ich habe das Programm nicht geschrieben. Es sollte aber funktionieren. Der Speicherfehler sollte eigentlich auch nicht auftreten. Deswegen frage ich ja.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1124866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1124866</guid><dc:creator><![CDATA[Neuling3001]]></dc:creator><pubDate>Sat, 26 Aug 2006 11:39:37 GMT</pubDate></item></channel></rss>