t3.5 write sd listing to file

Status
Not open for further replies.

Frankthetech

Active member
I'm trying to write a file to the sd card that contains a listing of all the files on the sd card.
my question is can I use root.ls(LS_R) and send it to a file instead of it sending to the serial?
I can do it with the printDirectory example but seems I should be able to send the output from root.ls to the sd card.
Any ideas, I'm thinking I need to redirect the stream somehow...
 
Ok I think I found it, I create a 'file savData' then call root.ls(&savData, LS_R); this sends the output to the savData file.
So far seems to work but I found a glitch,
When I send the output to the Serial with root.ls(LS_R) I get the following list..

ss718/
SteriA/
2020/

followed by the correct output. However when the stream is output using root.ls(&savData, LS_R) I see the following..

ss718/
S???????/
2020/
again followed by the correct output. I can't find the reason I get the S??????? instead of the SteriA I'm suppose to get.
If I look at the sd card I see the file got written with the S???????? as a folder name.
On the sd card itself the folders are named correctly.

(EDIT) OK so more testing, if I rename the 2nd folder to steriA from SteriA it works fine. Also if I try Unit1 it gives me the ??????
anything I try that has a folder name that starts with a capital letter it gives the question marks in the out put.
More testing required..
Also, if I try all caps it works fine. tried Unit = ????? but UNIT works fine. It seems to happen only when the first letter is a cap.
 
Last edited:
Status
Not open for further replies.
Back
Top