<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Runtime error' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Runtime error' posted on the 'Pascal' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 15:58:53 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 15:58:53 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313505/runtime-error/</link>
      <description>Hi,&lt;br /&gt;
does anyone here know what might be the cause of a &lt;br /&gt;
"Runtime error 100 at 001d:05C7"&lt;br /&gt;
&lt;br /&gt;
thx&lt;br /&gt;
NA&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313505/runtime-error/</guid>
      <pubDate>Sat, 27 Aug 2005 12:15:53 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313507/re-runtime-error/#313507</link>
      <description>: Hi,&lt;br /&gt;
: does anyone here know what might be the cause of a &lt;br /&gt;
: "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: &lt;br /&gt;
: thx&lt;br /&gt;
: NA&lt;br /&gt;
: &lt;br /&gt;
According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313507/re-runtime-error/#313507</guid>
      <pubDate>Sat, 27 Aug 2005 12:25:51 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313513/re-runtime-error/#313513</link>
      <description>: : Hi,&lt;br /&gt;
: : does anyone here know what might be the cause of a &lt;br /&gt;
: : "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: : &lt;br /&gt;
: : thx&lt;br /&gt;
: : NA&lt;br /&gt;
: : &lt;br /&gt;
: According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Any idea how I might go about fixing this?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313513/re-runtime-error/#313513</guid>
      <pubDate>Sat, 27 Aug 2005 15:00:31 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313524/re-runtime-error/#313524</link>
      <description>: : : Hi,&lt;br /&gt;
: : : does anyone here know what might be the cause of a &lt;br /&gt;
: : : "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: : : &lt;br /&gt;
: : : thx&lt;br /&gt;
: : : NA&lt;br /&gt;
: : : &lt;br /&gt;
: : According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: Any idea how I might go about fixing this?&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
What caused the error? Are you reading a file or Loading a pic or a sound file, etc? Are you directly accessing memory (Mem[$xxxx:$xxxx] := xxxx;)? Any of these could cause the error and the location doesn't help us without the code.&lt;br /&gt;
&lt;br /&gt;
Phat Nat&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313524/re-runtime-error/#313524</guid>
      <pubDate>Sat, 27 Aug 2005 17:09:29 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313565/re-runtime-error/#313565</link>
      <description>: : : : Hi,&lt;br /&gt;
: : : : does anyone here know what might be the cause of a &lt;br /&gt;
: : : : "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: : : : &lt;br /&gt;
: : : : thx&lt;br /&gt;
: : : : NA&lt;br /&gt;
: : : : &lt;br /&gt;
: : : According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;
: : : &lt;br /&gt;
: : &lt;br /&gt;
: : Any idea how I might go about fixing this?&lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: What caused the error? Are you reading a file or Loading a pic or a sound file, etc? Are you directly accessing memory (Mem[$xxxx:$xxxx] := xxxx;)? Any of these could cause the error and the location doesn't help us without the code.&lt;br /&gt;
: &lt;br /&gt;
: Phat Nat&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Im loading piuctures using the unit posted in the 'Bmp Graphics Unit' thread. The program stops in the middle of the unit. &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313565/re-runtime-error/#313565</guid>
      <pubDate>Sun, 28 Aug 2005 09:41:34 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313566/re-runtime-error/#313566</link>
      <description>: : : : Hi,&lt;br /&gt;
: : : : does anyone here know what might be the cause of a &lt;br /&gt;
: : : : "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: : : : &lt;br /&gt;
: : : : thx&lt;br /&gt;
: : : : NA&lt;br /&gt;
: : : : &lt;br /&gt;
: : : According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;
: : : &lt;br /&gt;
: : &lt;br /&gt;
: : Any idea how I might go about fixing this?&lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: What caused the error? Are you reading a file or Loading a pic or a sound file, etc? Are you directly accessing memory (Mem[$xxxx:$xxxx] := xxxx;)? Any of these could cause the error and the location doesn't help us without the code.&lt;br /&gt;
: &lt;br /&gt;
: Phat Nat&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
To be more precise, the compiler stops at this line:&lt;br /&gt;
BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313566/re-runtime-error/#313566</guid>
      <pubDate>Sun, 28 Aug 2005 09:51:25 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313579/re-runtime-error/#313579</link>
      <description>: : : : : Hi,&lt;br /&gt;
: : : : : does anyone here know what might be the cause of a &lt;br /&gt;
: : : : : "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: : : : : &lt;br /&gt;
: : : : : thx&lt;br /&gt;
: : : : : NA&lt;br /&gt;
: : : : : &lt;br /&gt;
: : : : According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;
: : : : &lt;br /&gt;
: : : &lt;br /&gt;
: : : Any idea how I might go about fixing this?&lt;br /&gt;
: : : &lt;br /&gt;
: : &lt;br /&gt;
: : What caused the error? Are you reading a file or Loading a pic or a sound file, etc? Are you directly accessing memory (Mem[$xxxx:$xxxx] := xxxx;)? Any of these could cause the error and the location doesn't help us without the code.&lt;br /&gt;
: : &lt;br /&gt;
: : Phat Nat&lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: To be more precise, the compiler stops at this line:&lt;br /&gt;
: BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
It sounds like you are loading a file that is not a BMP. Possibly it is a corrupted file or a file with size 0.&lt;br /&gt;
&lt;br /&gt;
Phat Nat&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313579/re-runtime-error/#313579</guid>
      <pubDate>Sun, 28 Aug 2005 12:28:36 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313707/re-runtime-error/#313707</link>
      <description>: : : : : : Hi,&lt;br /&gt;
: : : : : : does anyone here know what might be the cause of a &lt;br /&gt;
: : : : : : "Runtime error 100 at 001d:05C7"&lt;br /&gt;
: : : : : : &lt;br /&gt;
: : : : : : thx&lt;br /&gt;
: : : : : : NA&lt;br /&gt;
: : : : : : &lt;br /&gt;
: : : : : According to the help files, that error is triggered when you read past the end of a file.&lt;br /&gt;
: : : : : &lt;br /&gt;
: : : : &lt;br /&gt;
: : : : Any idea how I might go about fixing this?&lt;br /&gt;
: : : : &lt;br /&gt;
: : : &lt;br /&gt;
: : : What caused the error? Are you reading a file or Loading a pic or a sound file, etc? Are you directly accessing memory (Mem[$xxxx:$xxxx] := xxxx;)? Any of these could cause the error and the location doesn't help us without the code.&lt;br /&gt;
: : : &lt;br /&gt;
: : : Phat Nat&lt;br /&gt;
: : : &lt;br /&gt;
: : : &lt;br /&gt;
: : &lt;br /&gt;
: : To be more precise, the compiler stops at this line:&lt;br /&gt;
: : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));&lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: It sounds like you are loading a file that is not a BMP. Possibly it is a corrupted file or a file with size 0.&lt;br /&gt;
: &lt;br /&gt;
: Phat Nat&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I wouldnt see how that might be the case simply because &lt;br /&gt;
a) The program randomly (it seems) works and doesnt work. Sometimes it will run and at other times it wont run.&lt;br /&gt;
Whats even stranger, is that now the program ALWAYS runs but sometimes refuses to load pictures. Ive tried using different images, all of the saved with the same tool, but still the programs sometimes will and sometimes wont run. &lt;br /&gt;
Could this be the same error?&lt;br /&gt;
&lt;br /&gt;
Another thing that baffles me, is that  whenever I start the program from the compiler, it doesn load ANY pictures, wheras if I start from an EXE file it seems to work to the degree described above...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313707/re-runtime-error/#313707</guid>
      <pubDate>Mon, 29 Aug 2005 17:29:45 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313709/re-runtime-error/#313709</link>
      <description>: : : &lt;br /&gt;
: : : To be more precise, the compiler stops at this line:&lt;br /&gt;
: : : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));&lt;br /&gt;
: : : &lt;br /&gt;
: : : &lt;br /&gt;
: : &lt;br /&gt;
: : It sounds like you are loading a file that is not a BMP. Possibly it is a corrupted file or a file with size 0.&lt;br /&gt;
: : &lt;br /&gt;
: : Phat Nat&lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: I wouldnt see how that might be the case simply because &lt;br /&gt;
: a) The program randomly (it seems) works and doesnt work. Sometimes it will run and at other times it wont run.&lt;br /&gt;
: Whats even stranger, is that now the program ALWAYS runs but sometimes refuses to load pictures. Ive tried using different images, all of the saved with the same tool, but still the programs sometimes will and sometimes wont run. &lt;br /&gt;
: Could this be the same error?&lt;br /&gt;
: &lt;br /&gt;
: Another thing that baffles me, is that  whenever I start the program from the compiler, it doesn load ANY pictures, wheras if I start from an EXE file it seems to work to the degree described above...&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Hmm.. Sounds like my code may have an error. Although I'm sure that's not possible ;)&lt;br /&gt;
Post the code you've written and let me see if I can dupicate it on my end. If so, I should be able to track down the error, *hopefully*.&lt;br /&gt;
&lt;br /&gt;
Phat Nat&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313709/re-runtime-error/#313709</guid>
      <pubDate>Mon, 29 Aug 2005 17:59:19 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313797/re-runtime-error/#313797</link>
      <description>: : : : &lt;br /&gt;
: : : : To be more precise, the compiler stops at this line:&lt;br /&gt;
: : : : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));&lt;br /&gt;
: : : : &lt;br /&gt;
: : : : &lt;br /&gt;
: : : &lt;br /&gt;
: : : It sounds like you are loading a file that is not a BMP. Possibly it is a corrupted file or a file with size 0.&lt;br /&gt;
: : : &lt;br /&gt;
: : : Phat Nat&lt;br /&gt;
: : : &lt;br /&gt;
: : : &lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: : I wouldnt see how that might be the case simply because &lt;br /&gt;
: : a) The program randomly (it seems) works and doesnt work. Sometimes it will run and at other times it wont run.&lt;br /&gt;
: : Whats even stranger, is that now the program ALWAYS runs but sometimes refuses to load pictures. Ive tried using different images, all of the saved with the same tool, but still the programs sometimes will and sometimes wont run. &lt;br /&gt;
: : Could this be the same error?&lt;br /&gt;
: : &lt;br /&gt;
: : Another thing that baffles me, is that  whenever I start the program from the compiler, it doesn load ANY pictures, wheras if I start from an EXE file it seems to work to the degree described above...&lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: Hmm.. Sounds like my code may have an error. Although I'm sure that's not possible ;)&lt;br /&gt;
: Post the code you've written and let me see if I can dupicate it on my end. If so, I should be able to track down the error, *hopefully*.&lt;br /&gt;
: &lt;br /&gt;
: Phat Nat&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;

PROGRAM TestBMP;
USES Crt,Show_BMP,Dos;
VAR
   ClearColor : ColorType;
   Loaded : Boolean;
   i, runs: Integer;
   Filename: Array[1..5] of String;
   Answer: Array[1..5] of Char;
   mr, sr, hsr: Array[1..5] of Integer;
   hb, mb, sb, hsb: Word;
   h, m, s, hs: Word;


function IntToStr(I: Longint): String;
{ Convert any integer type to a string }
var
 S: string[11];
begin
 Str(I, S);
 IntToStr := S;
end;


BEGIN
  ClrScr;
 For i:=1 to 32 Do
 Begin
  Filename[i]:=IntToStr(i);
 End;

 Repeat
  Randomize;
   i:=Random(32+1);


     Graphix($13);
     { $13 = 320x200 8-bit (256 Color) Mode }
     ClearColor.Index := -1;
     { No Clear Color. Set this between 0 &amp;amp; 255 to make a see-through color }
     Loaded := ShowBMP(0,0, Filename[i]  +  '.BMP',True,ClearColor,VGA);
    { Loaded := ShowBMP(0,0, Filename[i] ,True,ClearColor,VGA); }
     { Returns True if BMP Loaded, False otherwise.
       First # is the starting Left position.    _/ Used to move a smaller
       Second # is the starting Top position.     \ BMP to middle of screen.
       Bitmap Name &amp;amp; Directory (NO long dir/filenames!)
       True/False = Used for loading the BMP Palette or not.
       ClearColor = of COLORTYPE. Index is used to display clear color.
       OUTPUT. In this case to VGA screen. Useful for sending to a Virtual Screen
     }
     If NOT(Loaded) Then     { If it didn't manage to load the BMP...}
     Begin
          DirectVideo := False;
          { Allow Writeln to write to the VGA screen }
          WriteLn('Failed to Load BMP!');
     End;
     GetTime(hb, mb, sb, hsb);
       repeat
          GotoXY(1, 1);
          GetTime(h, m, s, hs);
          write(m, s, hs);
       until Keypressed;
     ReadKey;
     SetTextMode;
     { Close down graphics and return to text mode }


     Writeln(m-mb, ':', s-sb, ':', hs-hsb);  {Work out how long it took}
     Write('Letter: ');
     runs:=runs+1;
     Readln(Answer[runs]);   {Store Data}
      mr[runs] := m-mb;        {Store Answer}
      sr[runs] := s-sb;
      hsr[runs]:= hs-hsb;
  Until runs=5;

     ClrScr;
     For i := 1 to 5 Do
     Begin
        Writeln(Answer[i],'    ', mr[i],':',sr[i],':', hsr[i]); {Spit Answers}  {Spit Time}
     End;
    Readln;

END.


--------------------------------------------------------------------------------
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313797/re-runtime-error/#313797</guid>
      <pubDate>Tue, 30 Aug 2005 09:23:57 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313849/re-runtime-error/#313849</link>
      <description>&lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by Phat Nat at  2005-8-30 18:50:13&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
You are wreaking havoc on your program! Seriously though, your problem is that you are overwriting valuable information on your program, causing it to run erratically. I have erased alot of the code, leaving the important parts:&lt;br /&gt;
&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: 
: PROGRAM TestBMP;
: USES Crt,Show_BMP,Dos;
: VAR
:    &lt;strong&gt;Filename: Array[1..5] of String;
(** This is being declared as having only 5 string variables **)&lt;/strong&gt;
:    Answer: Array[1..5] of Char;
:    mr, sr, hsr: Array[1..5] of Integer;
:    hb, mb, sb, hsb: Word;
:    h, m, s, hs: Word;: 
: 
: BEGIN
:   ClrScr;
:  For i:=1 to 32 Do
:  Begin
:   &lt;strong&gt;Filename[i]:=IntToStr(i);
(** This is being used as having 32 string variables **)&lt;/strong&gt;
:  End;
: 
:  Repeat
:   Randomize;
:    &lt;strong&gt;i:=Random(32+1);
(** This is being used as having 32 string variables **)&lt;/strong&gt;
: 
: 
:      Graphix($13);
:      { $13 = 320x200 8-bit (256 Color) Mode }
:      ClearColor.Index := -1;
:      { No Clear Color. Set this between 0 &amp;amp; 255 to make a see-through color }
:      Loaded := ShowBMP(0,0, Filename[i]+'.BMP',True,ClearColor,VGA);
: END.
: 
: &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As you see, throughout the program you are using FILENAME as having up to 32 string variables, where it is declared as only having 5. So when you Use FILENAME[6], you are actually overwriting part of ANSWER. After FILENAME[26], you start writing over the program code &amp;amp; other important stuff, causing strange random crashes/errors. A Preferred way of writing the above for quick change &amp;amp; safety is like so:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
&lt;strong&gt;CONST
   MaxFileNames = 32;&lt;/strong&gt;
VAR
   Filename: Array[1..&lt;strong&gt;MaxFileNames&lt;/strong&gt;] of String;
BEGIN
   ClrScr;
   For i:=1 to &lt;strong&gt;MaxFileNames&lt;/strong&gt; Do
   Begin
      Filename[i]:=IntToStr(i);
   End;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This way, you can change all the code at once in a matter of a couple of seconds.&lt;br /&gt;
&lt;br /&gt;
Phat Nat&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313849/re-runtime-error/#313849</guid>
      <pubDate>Tue, 30 Aug 2005 18:49:37 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Runtime error</title>
      <link>http://www.programmersheaven.com/mb/pasprog/313505/313937/re-runtime-error/#313937</link>
      <description>: &lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by Phat Nat at  2005-8-30 18:50:13&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
: You are wreaking havoc on your program! Seriously though, your problem is that you are overwriting valuable information on your program, causing it to run erratically. I have erased alot of the code, leaving the important parts:&lt;br /&gt;
: &lt;br /&gt;
: : &lt;pre class="sourcecode"&gt;
: : 
: : PROGRAM TestBMP;
: : USES Crt,Show_BMP,Dos;
: : VAR
: :    &lt;strong&gt;Filename: Array[1..5] of String;
: (** This is being declared as having only 5 string variables **)&lt;/strong&gt;
: :    Answer: Array[1..5] of Char;
: :    mr, sr, hsr: Array[1..5] of Integer;
: :    hb, mb, sb, hsb: Word;
: :    h, m, s, hs: Word;: 
: : 
: : BEGIN
: :   ClrScr;
: :  For i:=1 to 32 Do
: :  Begin
: :   &lt;strong&gt;Filename[i]:=IntToStr(i);
: (** This is being used as having 32 string variables **)&lt;/strong&gt;
: :  End;
: : 
: :  Repeat
: :   Randomize;
: :    &lt;strong&gt;i:=Random(32+1);
: (** This is being used as having 32 string variables **)&lt;/strong&gt;
: : 
: : 
: :      Graphix($13);
: :      { $13 = 320x200 8-bit (256 Color) Mode }
: :      ClearColor.Index := -1;
: :      { No Clear Color. Set this between 0 &amp;amp; 255 to make a see-through color }
: :      Loaded := ShowBMP(0,0, Filename[i]+'.BMP',True,ClearColor,VGA);
: : END.
: : 
: : &lt;/pre&gt;&lt;br /&gt;
: &lt;br /&gt;
: As you see, throughout the program you are using FILENAME as having up to 32 string variables, where it is declared as only having 5. So when you Use FILENAME[6], you are actually overwriting part of ANSWER. After FILENAME[26], you start writing over the program code &amp;amp; other important stuff, causing strange random crashes/errors. A Preferred way of writing the above for quick change &amp;amp; safety is like so:&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: &lt;strong&gt;CONST
:    MaxFileNames = 32;&lt;/strong&gt;
: VAR
:    Filename: Array[1..&lt;strong&gt;MaxFileNames&lt;/strong&gt;] of String;
: BEGIN
:    ClrScr;
:    For i:=1 to &lt;strong&gt;MaxFileNames&lt;/strong&gt; Do
:    Begin
:       Filename[i]:=IntToStr(i);
:    End;
: &lt;/pre&gt;&lt;br /&gt;
: &lt;br /&gt;
: This way, you can change all the code at once in a matter of a couple of seconds.&lt;br /&gt;
: &lt;br /&gt;
: Phat Nat&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Thanks, I totally missed that with the Filename array of only 1..5 and it  does correct the 'unable to display file' error! However, I dont see what you say about my program bein erratic. Surely, you understand that all the extra code ive tried to put in there is necessary for my progz bells and whistles[?]&lt;br /&gt;
I also dont understand why you gaze me exactly this section of code: &lt;br /&gt;
: : &lt;pre class="sourcecode"&gt;
: : 
: : PROGRAM TestBMP;
: : USES Crt,Show_BMP,Dos;
: : VAR
: :    &lt;strong&gt;Filename: Array[1..5] of String;
: (** This is being declared as having only 5 string variables **)&lt;/strong&gt;
: :    Answer: Array[1..5] of Char;
: :    mr, sr, hsr: Array[1..5] of Integer;
: :    hb, mb, sb, hsb: Word;
: :    h, m, s, hs: Word;: 
: : 
: : BEGIN
: :   ClrScr;
: :  For i:=1 to 32 Do
: :  Begin
: :   &lt;strong&gt;Filename[i]:=IntToStr(i);
: (** This is being used as having 32 string variables **)&lt;/strong&gt;
: :  End;
: : 
: :  Repeat
: :   Randomize;
: :    &lt;strong&gt;i:=Random(32+1);
: (** This is being used as having 32 string variables **)&lt;/strong&gt;
: : 
: : 
: :      Graphix($13);
: :      { $13 = 320x200 8-bit (256 Color) Mode }
: :      ClearColor.Index := -1;
: :      { No Clear Color. Set this between 0 &amp;amp; 255 to make a see-through color }
: :      Loaded := ShowBMP(0,0, Filename[i]+'.BMP',True,ClearColor,VGA);
: : END.
: : 
: : &lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
All parts are equally important...[?]&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/313505/313937/re-runtime-error/#313937</guid>
      <pubDate>Wed, 31 Aug 2005 15:13:24 -0700</pubDate>
      <category>Pascal</category>
    </item>
  </channel>
</rss>