This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-FlashFS: How to determine the length of a file

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

Parents
  • Flash-FS rules for file names are rather confusing.
    This is what I once got from Keil support:

    "The filename case handling was described by the developers like that:

    - if name is less than or equal 8 characters and extension less or equal to 3 and only one case characters, (all lower or all upper) file is coded as short filename which only contains upper cases letters so:
    test.txt => TEST.TXT
    TEST.TXT => TEST.TXT

    - if case of letters are mixed it is automatically considered a long filename and filename is encoded as it was written Test.txt => Test.txt teSt.txt => teSt.txt

    - if there are more than 8 characters in filename or more than 3 in extension or more . (dots) in filename it is encoded as long filename

    - filename Test.txt is different than filename tEst.txt as they are both long and encoded as they were written

    "

Reply
  • Flash-FS rules for file names are rather confusing.
    This is what I once got from Keil support:

    "The filename case handling was described by the developers like that:

    - if name is less than or equal 8 characters and extension less or equal to 3 and only one case characters, (all lower or all upper) file is coded as short filename which only contains upper cases letters so:
    test.txt => TEST.TXT
    TEST.TXT => TEST.TXT

    - if case of letters are mixed it is automatically considered a long filename and filename is encoded as it was written Test.txt => Test.txt teSt.txt => teSt.txt

    - if there are more than 8 characters in filename or more than 3 in extension or more . (dots) in filename it is encoded as long filename

    - filename Test.txt is different than filename tEst.txt as they are both long and encoded as they were written

    "

Children