Runtime error - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Runtime error

NinthAngleNinthAngle Posts: 98Member
Hi,
does anyone here know what might be the cause of a
"Runtime error 100 at 001d:05C7"

thx
NA
«1

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hi,
    : does anyone here know what might be the cause of a
    : "Runtime error 100 at 001d:05C7"
    :
    : thx
    : NA
    :
    According to the help files, that error is triggered when you read past the end of a file.
  • NinthAngleNinthAngle Posts: 98Member
    : : Hi,
    : : does anyone here know what might be the cause of a
    : : "Runtime error 100 at 001d:05C7"
    : :
    : : thx
    : : NA
    : :
    : According to the help files, that error is triggered when you read past the end of a file.
    :

    Any idea how I might go about fixing this?
  • Phat NatPhat Nat Posts: 757Member
    : : : Hi,
    : : : does anyone here know what might be the cause of a
    : : : "Runtime error 100 at 001d:05C7"
    : : :
    : : : thx
    : : : NA
    : : :
    : : According to the help files, that error is triggered when you read past the end of a file.
    : :
    :
    : Any idea how I might go about fixing this?
    :

    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.

    Phat Nat

  • NinthAngleNinthAngle Posts: 98Member
    : : : : Hi,
    : : : : does anyone here know what might be the cause of a
    : : : : "Runtime error 100 at 001d:05C7"
    : : : :
    : : : : thx
    : : : : NA
    : : : :
    : : : According to the help files, that error is triggered when you read past the end of a file.
    : : :
    : :
    : : Any idea how I might go about fixing this?
    : :
    :
    : 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.
    :
    : Phat Nat
    :
    :

    Im loading piuctures using the unit posted in the 'Bmp Graphics Unit' thread. The program stops in the middle of the unit.

  • NinthAngleNinthAngle Posts: 98Member
    : : : : Hi,
    : : : : does anyone here know what might be the cause of a
    : : : : "Runtime error 100 at 001d:05C7"
    : : : :
    : : : : thx
    : : : : NA
    : : : :
    : : : According to the help files, that error is triggered when you read past the end of a file.
    : : :
    : :
    : : Any idea how I might go about fixing this?
    : :
    :
    : 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.
    :
    : Phat Nat
    :
    :

    To be more precise, the compiler stops at this line:
    BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));

  • Phat NatPhat Nat Posts: 757Member
    : : : : : Hi,
    : : : : : does anyone here know what might be the cause of a
    : : : : : "Runtime error 100 at 001d:05C7"
    : : : : :
    : : : : : thx
    : : : : : NA
    : : : : :
    : : : : According to the help files, that error is triggered when you read past the end of a file.
    : : : :
    : : :
    : : : Any idea how I might go about fixing this?
    : : :
    : :
    : : 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.
    : :
    : : Phat Nat
    : :
    : :
    :
    : To be more precise, the compiler stops at this line:
    : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));
    :
    :

    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.

    Phat Nat

  • NinthAngleNinthAngle Posts: 98Member
    : : : : : : Hi,
    : : : : : : does anyone here know what might be the cause of a
    : : : : : : "Runtime error 100 at 001d:05C7"
    : : : : : :
    : : : : : : thx
    : : : : : : NA
    : : : : : :
    : : : : : According to the help files, that error is triggered when you read past the end of a file.
    : : : : :
    : : : :
    : : : : Any idea how I might go about fixing this?
    : : : :
    : : :
    : : : 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.
    : : :
    : : : Phat Nat
    : : :
    : : :
    : :
    : : To be more precise, the compiler stops at this line:
    : : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));
    : :
    : :
    :
    : 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.
    :
    : Phat Nat
    :
    :


    I wouldnt see how that might be the case simply because
    a) The program randomly (it seems) works and doesnt work. Sometimes it will run and at other times it wont run.
    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.
    Could this be the same error?

    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...





  • Phat NatPhat Nat Posts: 757Member
    : : :
    : : : To be more precise, the compiler stops at this line:
    : : : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));
    : : :
    : : :
    : :
    : : 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.
    : :
    : : Phat Nat
    : :
    : :
    :
    :
    : I wouldnt see how that might be the case simply because
    : a) The program randomly (it seems) works and doesnt work. Sometimes it will run and at other times it wont run.
    : 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.
    : Could this be the same error?
    :
    : 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...
    :

    Hmm.. Sounds like my code may have an error. Although I'm sure that's not possible ;)
    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*.

    Phat Nat

  • NinthAngleNinthAngle Posts: 98Member
    : : : :
    : : : : To be more precise, the compiler stops at this line:
    : : : : BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));
    : : : :
    : : : :
    : : :
    : : : 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.
    : : :
    : : : Phat Nat
    : : :
    : : :
    : :
    : :
    : : I wouldnt see how that might be the case simply because
    : : a) The program randomly (it seems) works and doesnt work. Sometimes it will run and at other times it wont run.
    : : 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.
    : : Could this be the same error?
    : :
    : : 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...
    : :
    :
    : Hmm.. Sounds like my code may have an error. Although I'm sure that's not possible ;)
    : 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*.
    :
    : Phat Nat
    :
    :

    [Code]

    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 & 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 & 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.


    --------------------------------------------------------------------------------
    [/Code]

  • Phat NatPhat Nat Posts: 757Member
    [b][red]This message was edited by Phat Nat at 2005-8-30 18:50:13[/red][/b][hr]
    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:

    : [Code]
    :
    : PROGRAM TestBMP;
    : USES Crt,Show_BMP,Dos;
    : VAR
    : [b]Filename: Array[1..5] of String;
    (** This is being declared as having only 5 string variables **)[/b]
    : 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
    : [b]Filename[i]:=IntToStr(i);
    (** This is being used as having 32 string variables **)[/b]
    : End;
    :
    : Repeat
    : Randomize;
    : [b]i:=Random(32+1);
    (** This is being used as having 32 string variables **)[/b]
    :
    :
    : Graphix($13);
    : { $13 = 320x200 8-bit (256 Color) Mode }
    : ClearColor.Index := -1;
    : { No Clear Color. Set this between 0 & 255 to make a see-through color }
    : Loaded := ShowBMP(0,0, Filename[i]+'.BMP',True,ClearColor,VGA);
    : END.
    :
    : [/Code]

    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 & other important stuff, causing strange random crashes/errors. A Preferred way of writing the above for quick change & safety is like so:
    [code]
    [b]CONST
    MaxFileNames = 32;[/b]
    VAR
    Filename: Array[1..[b]MaxFileNames[/b]] of String;
    BEGIN
    ClrScr;
    For i:=1 to [b]MaxFileNames[/b] Do
    Begin
    Filename[i]:=IntToStr(i);
    End;
    [/code]

    This way, you can change all the code at once in a matter of a couple of seconds.

    Phat Nat



«1
Sign In or Register to comment.