Error runtime 102

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error runtime 102

Janie Gan
Hi,

  I've been working on a program and each time i run it, it comes up wiht an
error runtime 102. I know it might have something to do with Assign, Amend
etc functions but can't figure out exactly where i went wrong. Here's an
example script.

Begin
  Assign(oldd,'DDNAMEold.txt');
  reset(oldd);
  REPEAT read (oldd,ystart,yddstart,P);
  UNTIL eof(oldd);
End

I've got this program from another person who's been working on this before
me. I'm a complete beginner and has been spending a week learning how to use
Pascal. Would appreciate it if someone can point out where I've gone wrong
and also how to fix it!

Thank you!

Janie


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Error runtime 102

Michael Van Canneyt


On Tue, 7 Mar 2006, Janie Gan wrote:

> Hi,
>
> I've been working on a program and each time i run it, it comes up wiht an
> error runtime 102. I know it might have something to do with Assign, Amend
> etc functions but can't figure out exactly where i went wrong. Here's an
> example script.
>
> Begin
> Assign(oldd,'DDNAMEold.txt');
> reset(oldd);
> REPEAT read (oldd,ystart,yddstart,P);
> UNTIL eof(oldd);

Try this:

  While not eof(oldd) do
    readln(oldd,ystart,yddstart,P);

Otherwise the program will not jump to the next line.

Also, you should check the variables: you can't read separate
strings like this, only numbers.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Error runtime 102

Alain Michaud
In reply to this post by Janie Gan
Hi,

if you have something like:

procedure mygoodprocedure
var
oldd : text
begin

then I would sugest that you put "text" line above:

unit myunit
...
var
oldd : text
...

procedure mygoodprocedure
var
...
begin

The file should be "global" , not in a procedure

goog luck

Alain

On Tue, 2006-03-07 at 23:54 +0800, Janie Gan wrote:

> Hi,
>
>   I've been working on a program and each time i run it, it comes up wiht an
> error runtime 102. I know it might have something to do with Assign, Amend
> etc functions but can't figure out exactly where i went wrong. Here's an
> example script.
>
> Begin
>   Assign(oldd,'DDNAMEold.txt');
>   reset(oldd);
>   REPEAT read (oldd,ystart,yddstart,P);
>   UNTIL eof(oldd);
> End
>
> I've got this program from another person who's been working on this before
> me. I'm a complete beginner and has been spending a week learning how to use
> Pascal. Would appreciate it if someone can point out where I've gone wrong
> and also how to fix it!
>
> Thank you!
>
> Janie
>
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal