SdFat. List of directories into a string instead of printing it to Serial.

Bolimpa

Member
Is it possible to get the list of directories to a string. Because I looked into the ls() function and it sends it to &serial. How could I get the names of the files and directories into a string?
 
You could simply enumerate the directory and grab the parts out of it and then decide what you wish to do with it.
Note: I do most of it with SD library wrapper, but similar...
 
I am using SdFat.h, not the normal SD.h library and if i try to use file.name() i get this error:

Code:
error: call to 'StreamFile<ExFatFile, long long unsigned int>::name' declared with attribute error: use getName(name, size)

And if I include the SD.h library and try to run File entry = dir.openNextFile(); i get this error:

Code:
error: conversion from 'ExFile' to non-scalar type 'File' requested

Should I use both libraries or what?
 
I would just use the SD.h file, it is a wrapper for the SDfat library.

As @KurtE said : {local install}\hardware\teensy\avr\libraries\SD\examples\listfiles\listfiles.ino seems to show the common code linked above.

And indeed SD.H wraps the PJRC specific version of SDFat - using the SD.h interfaces works. The SDFat code is available for use ( see: {local}\hardware\teensy\avr\libraries\SD\examples\SdFat_Usage\SdFat_Usage.ino ) but mixing and matching can cause trouble
 
Back
Top