Announcement

Collapse
No announcement yet.

File_Open, File_Read and file name

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • File_Open, File_Read and file name

    Hello,

    I am facing a problme with opening/reading some text files stored on the SD card of the Gen4 Diablo.

    Using a simple code as below work fine
    Code:
    handle := file_Open("Mode1.txt", 'r');
    strLength := file_GetS(buff, 50, handle) ;
    print([STR]buff);
    file_Close(handle);
    However, as soon as my file name gets longer, it won't work.
    Code:
    handle := file_Open("Caption_Mode1.txt", 'r');
    strLength := file_GetS(buff, 50, handle) ;
    print([STR]buff);
    file_Close(handle);
    The limit seem to be about : 8 char, excluding the extension .txt

    Is there any workaround ?
    I am planning to store a ~150 reference files on my SD card, so being able to name them with a longer name could be nice.

    Also, is it possible to open txt files, stored in subfolder ?
    I tried something like above, but did not get any result. Might be the same file name length issue.
    Code:
    handle := file_Open(".\MySubFolder\Mode1.txt", 'r');
    Thanks.

  • #2
    Hello Vincent,

    To read the file which contains more than 8 characters, go to Command Prompt, change your directory (uSD Card), and type 'dir /x'.
    You can see there the filename which you can use in the Workshop4 to read the file.

    You can now use the file which should be something like this:

    Code:
    handle:=file_Open("CAPTIO~1.txt",'r');
    strLength := file_GetS(buff, 50, handle) ;
    print([STR]buff);
    file_Close(handle);
    Also, is it possible to open txt files, stored in subfolder ?
    Unforunately, you can only have access to the root folder of the uSD Card.


    I hope this helps.
    Best Regards,
    Kevin

    Comment

    Working...
    X