<?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[Fehlermeldung: EAccessViolation]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich diesen Quelltext kompiliere, und über einen Button, ein Objekt bilde und eine Methode dieser Klasse aufrufe erhalte ich folgenden Fehler:</p>
<p>&quot;Im Projekt ist eine Exception der Klasse EAccessViolation auftetreten. Meldung: Zugriffsverletzung bei Adresse...&quot;</p>
<p>Hier der Quelltext:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;zahlenwandler.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;

class Wandler
{
private:
        int dualValue;
        char binaryValue[8];
        char hexValue[2];

public:
       void auswahl();
       char DualToBinary(dualValue);
       char DualToHex(dualValue);
       char BinaryToDual(binaryValue[8]);
       char BinaryToHex(binaryValue[8]);
       char HexToDual(hexValue[2]);
       char HexToBinary(hexValue[2]);
       Wandler();
};

//==================================== FUNKTIONEN ===========================
//===========================================================================
// ---------------------------------- FUNKTION: AUSWAHL ---------------------
void Wandler::auswahl(){
bool vorgDual = Form1-&gt;vorgDual-&gt;Checked;
bool ergDual = Form1-&gt;vorgDual-&gt;Checked;
                        if((vorgDual == true) &amp;&amp; (ergDual == true))
                                                     {
                                                      Form1-&gt;ergebnis-&gt;Text = Form1-&gt;vorgabe-&gt;Text;
                                                     }
                        /* !!!! TO DO: weitere Auswahlmöglichkeiten einfügen !!! */
                       }

//---------------------------------- FUNKTION: DualToBinary------------------

char Wandler::DualToBinary(int dualValue)
                                     {
                                     for(int i = 7; i--; i&gt;=0)
                                             {
                                              if(dualValue &lt;= 2^i)
                                                           {
                                                            dualValue = dualValue - 2^i;
                                                            binaryValue[i] = 1;
                                                           }
                                              else binaryValue[i] = 0;

                                             }
                                     return binaryValue[8];
                                     }

//------------------------------------ KONSTRUKTOR --------------------------

Wandler::Wandler()
                  {

                   dualValue = 0;

                   for(int i=0; i++; i&lt;=7)
                           {
                            binaryValue[i] = 0;
                           }

                   for(int i=0; i++; i&lt;=1)
                           {
                            hexValue[i] = 0;
                           }

                  }

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::wandelnClick(TObject *Sender)
{

Wandler* meinWandler = new Wandler();
meinWandler-&gt;auswahl();

}
//---------------------------------------------------------------------------
</code></pre>
<p>Im Quelltext weist er mich dann auf folgende Stelle hin:<br />
(Funktion auswahl())!</p>
<p>[cpp]</p>
<p>void Wandler::auswahl(){<br />
<strong>bool vorgDual = Form1-&gt;vorgDual-&gt;Checked;</strong><br />
bool ergDual = Form1-&gt;vorgDual-&gt;Checked;<br />
if((vorgDual == true) &amp;&amp; (ergDual == true))<br />
{<br />
Form1-&gt;ergebnis-&gt;Text = Form1-&gt;vorgabe-&gt;Text;<br />
}<br />
/* !!!! TO DO: weitere Auswahlmöglichkeiten einfügen !!! */<br />
}<br />
[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123322/fehlermeldung-eaccessviolation</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 08:56:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123322.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Oct 2005 11:54:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehlermeldung: EAccessViolation on Sat, 15 Oct 2005 11:56:23 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich diesen Quelltext kompiliere, und über einen Button, ein Objekt bilde und eine Methode dieser Klasse aufrufe erhalte ich folgenden Fehler:</p>
<p>&quot;Im Projekt ist eine Exception der Klasse EAccessViolation auftetreten. Meldung: Zugriffsverletzung bei Adresse...&quot;</p>
<p>Hier der Quelltext:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;zahlenwandler.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;

class Wandler
{
private:
        int dualValue;
        char binaryValue[8];
        char hexValue[2];

public:
       void auswahl();
       char DualToBinary(dualValue);
       char DualToHex(dualValue);
       char BinaryToDual(binaryValue[8]);
       char BinaryToHex(binaryValue[8]);
       char HexToDual(hexValue[2]);
       char HexToBinary(hexValue[2]);
       Wandler();
};

//==================================== FUNKTIONEN ===========================
//===========================================================================
// ---------------------------------- FUNKTION: AUSWAHL ---------------------
void Wandler::auswahl(){
bool vorgDual = Form1-&gt;vorgDual-&gt;Checked;
bool ergDual = Form1-&gt;vorgDual-&gt;Checked;
                        if((vorgDual == true) &amp;&amp; (ergDual == true))
                                                     {
                                                      Form1-&gt;ergebnis-&gt;Text = Form1-&gt;vorgabe-&gt;Text;
                                                     }
                        /* !!!! TO DO: weitere Auswahlmöglichkeiten einfügen !!! */
                       }

//---------------------------------- FUNKTION: DualToBinary------------------

char Wandler::DualToBinary(int dualValue)
                                     {
                                     for(int i = 7; i--; i&gt;=0)
                                             {
                                              if(dualValue &lt;= 2^i)
                                                           {
                                                            dualValue = dualValue - 2^i;
                                                            binaryValue[i] = 1;
                                                           }
                                              else binaryValue[i] = 0;

                                             }
                                     return binaryValue[8];
                                     }

//------------------------------------ KONSTRUKTOR --------------------------

Wandler::Wandler()
                  {

                   dualValue = 0;

                   for(int i=0; i++; i&lt;=7)
                           {
                            binaryValue[i] = 0;
                           }

                   for(int i=0; i++; i&lt;=1)
                           {
                            hexValue[i] = 0;
                           }

                  }

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::wandelnClick(TObject *Sender)
{

Wandler* meinWandler = new Wandler();
meinWandler-&gt;auswahl();

}
//---------------------------------------------------------------------------
</code></pre>
<p>Im Quelltext weist er mich dann auf folgende Stelle hin:<br />
(Funktion auswahl())!</p>
<p>[cpp]</p>
<p>void Wandler::auswahl(){<br />
<strong>bool vorgDual = Form1-&gt;vorgDual-&gt;Checked;</strong><br />
bool ergDual = Form1-&gt;vorgDual-&gt;Checked;<br />
if((vorgDual == true) &amp;&amp; (ergDual == true))<br />
{<br />
Form1-&gt;ergebnis-&gt;Text = Form1-&gt;vorgabe-&gt;Text;<br />
}<br />
/* !!!! TO DO: weitere Auswahlmöglichkeiten einfügen !!! */<br />
}<br />
[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892775</guid><dc:creator><![CDATA[longInt]]></dc:creator><pubDate>Sat, 15 Oct 2005 11:56:23 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung: EAccessViolation on Sat, 15 Oct 2005 13:53:01 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Eine AccessViolation zeigt an, dass du mit einem ungültigen Pointer arbeitest. Was ist denn Form1-&gt;vorgDual? Woher kennt deine Wandler Klasse Form1?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892842</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Sat, 15 Oct 2005 13:53:01 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung: EAccessViolation on Sat, 15 Oct 2005 14:10:38 GMT]]></title><description><![CDATA[<p>Form1 ist doch mein Fenster. vorgDual ist ein Radiobutton.</p>
<p>Kann es nicht sein, dass ich mein Objekt falsch erzeuge?</p>
<pre><code class="language-cpp">Wandler* meinWandler = new Wandler();
</code></pre>
<p>Das ist der einzige Pointer, den ich verwende :-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892856</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892856</guid><dc:creator><![CDATA[longInt]]></dc:creator><pubDate>Sat, 15 Oct 2005 14:10:38 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung: EAccessViolation on Sat, 15 Oct 2005 16:06:06 GMT]]></title><description><![CDATA[<p>Das sieht schon ok aus. Das hier</p>
<pre><code class="language-cpp">return binaryValue[8];
</code></pre>
<p>ist aber falsch. binaryValue hat ja nur 8 Elemente und du greifst auf das 9. zu.<br />
Warum hast du deine Wandlerklasse außerhalb von Form1 deklariert? Du greifst ja innerhalb dieser Klasse auf Objekte von Form1 zu. Diese Klasse würde ja ohne Form1 nicht funktionieren.<br />
Versuche mal die Klasse etwas unabhängiger zu machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892930</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892930</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Sat, 15 Oct 2005 16:06:06 GMT</pubDate></item></channel></rss>