![]() |
Forum Index : Microcontroller and PC projects : accessing a file type automatically on an SD card
Author | Message | ||||
jovian Regular Member ![]() Joined: 16/04/2017 Location: AustraliaPosts: 63 |
Hi all I am making good progress loading a CSV file into mmbasic so I can pre-program data in a spreadsheet. I export from the sheet as CSV and it creates a generic "namexxx.csv" file name. I can access the file from mmBasic no problem using Open "" for input as Now I would like the program to search the card and identify the first .csv file it encounters so I may read it, without needing to name the file in advance. When I use dir$ I get a flag error... I am not sure of the nomenclature, and can't find it in the manual. ChatGPT is unable to help too. I can't find any use of dir$ on fruitoftheshed. Can anyone help? Thanks Jo |
||||
disco4now![]() Guru ![]() Joined: 18/12/2014 Location: AustraliaPosts: 1001 |
Something like this should work.You would need to enhance it to search the directories if that is not known. dim first$,f$ ' chdir("/") chdir("/tests") f$=DIR$("*.csv",FILE) first$=f$ 'Print #1, f$+":--all" 'Print #1, f$ ? " Added... "+f$ Do While f$ <> "" f$=DIR$() if f$<>"" then 'Print #1, f$ ? " Added... "+f$ endif If first$ = "" Then first$ = f$ LOOP ' chdir("/") Latest F4 Latest H7 FotS |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |