[net.micro.pc] Three Microsoft Pascal questions

Tom.Wood@cmu-ri-fas.arpa (04/20/84)

    Is there a graceful way to recover from I/O errors in MS Pascal?  In
particular, I would like the ability to determine whether assign()/reset()
opens a file successfully, and if not, try again with another name.
Alternatively, a function that checks to see if a file exists would do
the trick.

    Anyone have a Pascal callable random number generator?

    And, I can't seem to get the 'TICS' function to work (supposed to return
the time, in ticks.)  Is it supposed to work with the IBM PC?  If not, is
there an easy way to ask MS-DOS for the time?

    If the answers to these questions have appeared in previous digests, I'd
appreciate it if someone could point me to the volume/date.  Thanks.

				-Tom Wood
				 C-MU Robotics Institute
				 taw@cmu-ri-fas

todd@islenet.UUCP (Todd Ogasawara) (04/27/84)

I only have the answer to the question of trapping i/o errors.  This
info is based on the older IBM Pascal (MS-Pascal is several generations
ahead) and may not be completely true for the new implementation.

	assign (fp, filename);	{filename assigned}
	fp.trap := true;	{trap errors here}
	if fp.errs = 10
	  then writeln('File ',filename,' does not exist.');

Each file has its own 'trap' and 'errs' system values.  Thus, you do
not need to declare 'fp.trap' and 'fp.errs'.  Hope this helps you.

Todd Ogasawara -- University of Hawaii -- Dept. of Psychology
          { dual,vortex,uhpgvax }!islenet!todd