Board index » delphi » Access Violation when reading/writing an array in Delphi 2.0

Access Violation when reading/writing an array in Delphi 2.0

I need some help badly.

I had a unit that I was using in Delphi 1.0.  I made some changes to the
code and ported it over to 2.0.  Everything works fine.  

The only problem is one of the arrays I have 'ZONE'.  I modify it about
10-20 times with other procedures.  But when I call THE procedure that
bombs out on me it gives me this weird error: 'Access violation at
address #########.  Read of address ########'  

The procedure is doing nothing complicated with the array, actually I've
simplified what it does to see if I could narrow it down, and it now
bombs out as soon as it reaches this statement:
'showMessage(zone[1].pid)'.  Zone is the array, and pid is a ten digit
number stored in a string.  

Any help is appreciated...tia.

 

Re:Access Violation when reading/writing an array in Delphi 2.0


Quote
Gus Perez <gpe...@gate.net> wrote:
>I need some help badly.
>I had a unit that I was using in Delphi 1.0.  I made some changes to the
>code and ported it over to 2.0.  Everything works fine.  
>The only problem is one of the arrays I have 'ZONE'.  I modify it about
>10-20 times with other procedures.  But when I call THE procedure that
>bombs out on me it gives me this weird error: 'Access violation at
>address #########.  Read of address ########'  
>The procedure is doing nothing complicated with the array, actually I've
>simplified what it does to see if I could narrow it down, and it now
>bombs out as soon as it reaches this statement:
>'showMessage(zone[1].pid)'.  Zone is the array, and pid is a ten digit
>number stored in a string.  

Hmm. What sort of string? If you look at zone[1] in the de{*word*81} what
do you see?

Note that by default D2 gives you long strings which are implemented
differently to regular strings. Also I've noticed that the dynamic
memory managment in D2 seems to be less forgiving if you corrupt
memory.
--
Bob Cousins, Software Engineer.
http://www.demon.co.uk/sirius-{*word*104}netics/

Other Threads