[comp.lang.pascal] Check to see if file exists ????????

Chris_Krohn@mindlink.bc.ca (Chris Krohn) (05/31/91)

  I don't know anything about DEC machines, but I figure you can trap for the
error that occurs when you try to access the file.  ie: if the user enters a
filename, and you go to get the file and get an error, the user has obviously
entered a filename that does not exist.  This should work....(I hope =)

                                        Chris Krohn
                                        Mindlink - Vancouver, BC

cpawn@marlin.jcu.edu.au (Andrew W Nicholson) (06/01/91)

What I need to know is how to check if a filename input by the user
exists.

I have the following types and variables:-

type
	string40 = array[1..40] of char;
var
	in_file_name : string40;
	data_file : file of char;

This is pascal on a Ultrix DEC station, not TP or any other fancy versions.

After I prompt the user for the in_file_name and read it in, how do I
check to see if the in_file_name given really exists?

I need this because if the user enters an invalid in_file_name, the
program bombs when I try to access it, which makes sense of course.

Any ideas greatly accepted.

			Andrew.


-- 
    _--_|\,-----From Townsville in sunny North Queensland      *
   /      \                                                  *   *
   \_.--._/     Andrew Nicholson  cpawn@marlin.jcu.edu.au       '
         v                                                     *