evaluating if a file is there before reading
Posted: Thu Sep 09, 2010 7:30 pm
In the project i am currently working on, I initialize an array by reading from a txt file on start up. I use the following code
That works fine. But In the event that the "downloader.ini" file has been deleted I want to instead initialize the tDataLoad array from a default copy saved as a custom property of the stack. I have the custom property saved as cBlankINI of stack "downloader". That part works fine. Where I am having trouble, is in the evaluation of the existence of file "downloader.ini" what would be the proper way to determine if the file exists before reading from it?
Code: Select all
on importText
global tDataLoad
open file "downloader.ini" for read
read from file "downloader.ini" until eof
put it into tDataLoad
close file "downloader.ini"
end importText