<p dir="ltr"><br>
On 13 Aug 2015 10:15 PM, "Chris Moody" <<a href="mailto:inquiry@greensnakedesign.com">inquiry@greensnakedesign.com</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> I have this procedure in my program:<br>
><br>
> procedure DisplayNode (var node:astring);<br>
> var c, i:integer;<br>
> begin<br>
> i:=SizeOf(node);<br>
> if (i=0) then begin<br>
> writeln ('node was empty / non existant');<br>
> exit;<br>
> end;<br>
> for c:=0 to i do<br>
> writeln (node[c]); // line 85<br>
> end;<br>
><br>
> astring is an Array of String<br>
><br>
> The code compiles fine, however when I run it I get:<br>
><br>
> An unhandled exception occurred at $0000000000400B3A :<br>
> EAccessViolation : Access violation<br>
> $0000000000400B3A line 85 of Dentist.pas<br>
> $0000000000400C8C line 95 of Dentist.pas<br>
><br>
> Line 85 is the writeln above, line 95 is where I call this procedure from the main code.<br>
><br>
> How do I track down what is going on?<br>
><br>
> If your familiar with PHP, my purpose of this procedure is to basically emulate the following code:<br>
> <pre><?php print_r (node); ?></pre><br>
><br>
> Thanks in advance,<br>
><br>
> Chris</p>
<p dir="ltr">SizeOf(node) will return the size of the pointer to node. I suspect you want to loop over elements in an array so use length(node) to find out the number of elements in node.<br>
</p>