|
| Crash when assigning value to array. tp7.0 |
 |
Mon, 02 Oct 2006 13:34:52 +020 |
Hi..
I am using turbo pascal 7.0
When i start the prog below the computer crashes.
In the first loop when forCount has reached 33 :
for forCount:=0 to 100 do
begin
ChannelA^[forCount]:=random(256)-128;
writeln('forCount=',forCount,'
ChannelA^[forCount]=',ChannelA^[forCount]);
end;
Why does this happen ?
How can i prevent this ?
Thank !
{
experiment with array and pointers.
WARNING THIS PROG REBOOTS MY COMPUTER AND I DO NOT KNOW WHY !
By Vroemm@wanadoo.nl
USE AT YOUR OWN RISK !
}
program experi1;
uses dos, crt;
type
arr = array [0..641] of shortint;
arrptr = ^arr;
var
ChannelA:arrptr;
ChannelB:arrptr;
ChannelAold:arrptr;
ChannelBold:arrptr;
forCount : longint;
begin
randomize;
{ THIS FOR LOOP CRASHES THE COMPUTER AT forCount=33}
for forCount:=0 to 100 do
begin
ChannelA^[forCount]:=random(256)-128;
writeln('forCount=',forCount,'
ChannelA^[forCount]=',ChannelA^[forCount]);
end;
ReadKey;
for forCount:=0 to 100 do
begin
ChannelAold^[forCount]:=ChannelA^[forCount];
writeln('forCount=',forCount);
end;
end.
--
hihihi
wanadoo
|
| Post Reply
|
| Re: Crash when assigning value to array. tp7.0 |
 |
Mon, 02 Oct 2006 16:36:02 +030 |
You are lucky men - it should crash at forCount = 0.
Rimvydas
hihihi wrote:
> Hi..
>
> I am using turbo pascal 7.0
> When i start the prog below the computer crashes.
> In the first loop when forCount has reached 33 :
>
> for forCount:=0 to 100 do
> begin
> ChannelA^[forCount]:=random(256)-128;
> writeln('forCount=',forCount,'
> ChannelA^[forCount]=',ChannelA^[forCount]);
> end;
>
> Why does this happen ?
> How can i prevent this ?
>
> Thank !
>
> {
> experiment with array and pointers.
>
> WARNING THIS PROG REBOOTS MY COMPUTER AND I DO NOT KNOW WHY !
>
> By Vroemm@wanadoo.nl
> USE AT YOUR OWN RISK !
> }
>
> program experi1;
>
> uses dos, crt;
>
> type
> arr = array [0..641] of shortint;
> arrptr = ^arr;
>
> var
> ChannelA:arrptr;
> ChannelB:arrptr;
> ChannelAold:arrptr;
> ChannelBold:arrptr;
>
> forCount : longint;
>
> begin
> randomize;
>
> { THIS FOR LOOP CRASHES THE COMPUTER AT forCount=33}
> for forCount:=0 to 100 do
> begin
> ChannelA^[forCount]:=random(256)-128;
> writeln('forCount=',forCount,'
> ChannelA^[forCount]=',ChannelA^[forCount]);
> end;
>
> ReadKey;
>
> for forCount:=0 to 100 do
> begin
> ChannelAold^[forCount]:=ChannelA^[forCount];
> writeln('forCount=',forCount);
> end;
> end.
>
> --
> hihihi
> wanadoo
> nl
|
| Post Reply
|
| Re: Crash when assigning value to array. tp7.0 |
 |
Mon, 02 Oct 2006 16:57:09 +020 |
Rimvydas Paulavicius wrote:
> You are lucky men - it should crash at forCount = 0.
Indeed.
I think i found it.
I forgot
new(ChannelA);
new(ChannelB);
new(ChannelAold);
new(ChannelBold);
It works now, as far as i can see.
Except for other problems with ugraf.
>
> Rimvydas
>
> hihihi wrote:
>
>> Hi..
>>
>> I am using turbo pascal 7.0
>> When i start the prog below the computer crashes.
>> In the first loop when forCount has reached 33 :
>>
>> for forCount:=0 to 100 do
>> begin
>> ChannelA^[forCount]:=random(256)-128;
>> writeln('forCount=',forCount,'
>> ChannelA^[forCount]=',ChannelA^[forCount]);
>> end;
>>
>> Why does this happen ?
>> How can i prevent this ?
>>
>> Thank !
>>
>> {
>> experiment with array and pointers.
>>
>> WARNING THIS PROG REBOOTS MY COMPUTER AND I DO NOT KNOW WHY !
>>
>> By Vroemm@wanadoo.nl
>> USE AT YOUR OWN RISK !
>> }
>>
>> program experi1;
>>
>> uses dos, crt;
>>
>> type
>> arr = array [0..641] of shortint;
>> arrptr = ^arr;
>>
>> var
>> ChannelA:arrptr;
>> ChannelB:arrptr;
>> ChannelAold:arrptr;
>> ChannelBold:arrptr;
>>
>> forCount : longint;
>>
>> begin
>> randomize;
>>
>> { THIS FOR LOOP CRASHES THE COMPUTER AT forCount=33}
>> for forCount:=0 to 100 do
>> begin
>> ChannelA^[forCount]:=random(256)-128;
>> writeln('forCount=',forCount,'
>> ChannelA^[forCount]=',ChannelA^[forCount]);
>> end;
>>
>> ReadKey;
>>
>> for forCount:=0 to 100 do
>> begin
>> ChannelAold^[forCount]:=ChannelA^[forCount];
>> writeln('forCount=',forCount);
>> end;
>> end.
>>
>> --
>> hihihi
>> wanadoo
>> nl
--
hihihi
wanadoo
|
| Post Reply
|
| Re: Crash when assigning value to array. tp7.0 |
 |
8 Oct 2006 09:35:01 -0700 |
Hi,
Which operating system do you use?
On Windows NT/2000/XP a full crash SHOULDN'T happen at all.
Only the 16 bit subsystem or only one instace might happen to
crash.
On Windows 3.x and 9X a full crash CAN happen, but this isn't
necessary.
With regards from
|
| Post Reply
|
| Re: Crash when assigning value to array. tp7.0 |
 |
Tue, 10 Oct 2006 22:01:23 +020 |
Tom van der Vlugt wrote:
> Which operating system do you use?
> On Windows NT/2000/XP a full crash SHOULDN'T happen at all.
> Only the 16 bit subsystem or only one instace might happen to
> crash.
> On Windows 3.x and 9X a full crash CAN happen, but this isn't
> necessary.
It was msdos 6.22 :-)
Which apparently can crash :-)
Problem is solved.
--
hihihi
wanadoo
|
| Post Reply
|
|
|
|
|
|
|
|
|
|