Posted: Thu Mar 13, 2008 11:36 pm Post subject: Error Check for reading from text files
In the program I am making, the user inputs the filename of the text file that they would like to open. If this file does not exist, the program instantly crashes. Is it possible to make some sort of error check to see if the file exists or not before trying to open it? Thanks in advance.
Sponsor Sponsor
HeavenAgain
Posted: Thu Mar 13, 2008 11:42 pm Post subject: RE:Error Check for reading from text files
code:
var pathName : string
var choice : string
loop
put "Enter file name to write results to" ..
get pathName
if File.Exists (pathName) then
put "Overwrite ", pathName, "?" ..
get choice
exit when choice = "y"
else
exit
end if
end loop
from F10 turing help
FalconPAwnch
Posted: Thu Mar 13, 2008 11:47 pm Post subject: Re: Error Check for reading from text files
That's from the F10 Turing help? Wow do I feel stupid. Thanks a bunch though dude, you may have just saved my life.