Kye's SD2.0_FATengine - how to check if a file exists?
Microcontrolled
Posts: 2,461
I've recently made the switch from the ever popular fsrw SD program to Kye's driver because I needed multiple directory support. I made my program I'm working over switch perfectly, except that wheras with fsrw I could have the PROGRAM see if the file exists by calling popen and getting the return value, FATengine returns a hard-to-read abort string. I'm using Raymans 4.3" LCD, and it goes black when the FATengine aborts, I'm not sure why. I went in the program and changed the "abort @filedoesntexist" with "return 3" and set up a test program with the same results. If I can only read I file I know is there, this program will not be of much use and I'll go back to the old fsrw. I could just be missing something as there are many functions in the FATengine program. Is there a function for checking the availibility of a file? If so can someone direct me to it?
ANY help is appreciated, thanks!
Micro
ANY help is appreciated, thanks!
Micro
Comments
\engine.fileOpen(@name,mode)
if engine.checkErrorNumber == engine#File_Not_Found
' file not found error occurred
Also... try
variableName := \engine.fileOpen(@name,mode)
vs
\engine.fileOpen(@name,mode)
... I'd had PROBLEMS!!! with SPIN when you don't do that.
Note that the checkErrorNumber function returns the most recent error only and is cleared after you read it.