Hi all,
when I try to determine the lenhth of a file I use following code:
int flength(char *filename) { FILE* file; FINFO info; file = fopen(filename,"r"); if(!file) { return(-1); } fclose(file); info.fileID = 0; while(ffind(filename, &info)==0); if(info.fileID == 0) { return(-1); } return(info.size); }
All works fine as long as I use simple filenames like "F:test.txt". As soon as I try to do this with filenames including subfolders ("F:\\test\\test.txt") it fails.
Is there another way to determine the length of a file? Why won't ffind() not work with subfolders?
Any ideas? Marco
As far as I understand, ffind work just like the proposed solution that "works". Your fopen might still failed unless you follow the naming conventions of Flash-FS.