FILE_DirExists with variable Dir

 

thats works:

FILE\_DirExists("a");// check for a Folder named a

 

get the warning:“warning: passing argument 1 of ‘FILE_DirExists’ makes pointer from integer without a cast [enabled by default]”

char directory = ’a’ FILE\_DirExists(directory);// directory is a variable

 

_ is it possible to check for a Variable-Dir? _

file.c says:

///////////////////////////////////////////////////////////////////////////// //! Returns 1 if directory exists, 0 if it doesn't exist, \< 0 on errors ///////////////////////////////////////////////////////////////////////////// s32 FILE\_DirExists(char \*path) { DIR dir; if( !volume\_available ) { #if DEBUG\_VERBOSE\_LEVEL \>= 2 DEBUG\_MSG("[FILE\_DirExists] ERROR: volume doesn't exist!\n"); #endif return FILE\_ERR\_NO\_VOLUME; } if( !path || !path[0] ) return 0; // empty directory name - handle like if it doesn't exist return (file\_dfs\_errno=f\_opendir(&dir, path)) == FR\_OK; }

 

i got it:

// change Folder Directory - letter loadet from previos loaded SYS-File char Folder = 'a'; char path[8]; strncpy(path,"a ", 8); path[0] = Folder; statusDir = FILE\_DirExists(path);// ask file.c: exist a folder "a/" on the CARD? //

or:

char Folder = ’A’; char path[8]; // Build File Path/0.t4 " sprintf (path, "%c/0.b4",Folder); // ask file.c: exist a file "A/0.b4" on the CARD? // statusFile\_patch = FILE\_FileExists(path);

and for delete all Files - and Directory(if all files are known and already deleted

// you need to delete each file on its own... int c; for (c=0; c\<256; c++){ char remove[9]; // make a new filename depending on the counter value sprintf (remove, "%c/%d.b4",Folder,c); // Remove FILEs MUTEX\_SDCARD\_TAKE; FILE\_Remove(remove); MUTEX\_SDCARD\_GIVE; } // Remove Directory (can only be done if it empty // build path char remove[8]; sprintf (remove, "%c",Folder); MUTEX\_SDCARD\_TAKE; FILE\_Remove(remove); MUTEX\_SDCARD\_GIVE;

whoud be interesting, how to delete a folder if the Files inside are not known?