Closed GoogleCodeExporter closed 9 years ago
Just noticed this with 1.0.1. It's a simple fix, and only seems to be needed in
the lisfiles example.
Probably a result of pre 1.0 not supporting multiple open files.
Original comment by j...@blackcatmicro.com
on 30 May 2012 at 6:57
see also issue 904
http://code.google.com/p/arduino/issues/detail?id=904
Original comment by j...@blackcatmicro.com
on 30 May 2012 at 6:59
The resolution is simple and does not require any modifications to SD.cpp.
Simply add entry.close() to the example code as shown below.
Gary
void printDirectory(File dir, int numTabs) {
while(true) {
File entry = dir.openNextFile();
if (! entry) {
// no more files
// return to the first file in the directory
dir.rewindDirectory();
break;
}
for (uint8_t i=0; i<numTabs; i++) {
Serial.print('\t');
}
Serial.print(entry.name());
if (entry.isDirectory()) {
Serial.println("/");
printDirectory(entry, numTabs+1);
} else {
// files have sizes, directories do not
Serial.print("\t\t");
Serial.println(entry.size(), DEC);
}
entry.close();
}
}
Original comment by garygfle...@hotmail.com
on 30 Oct 2012 at 8:48
fixed on master. thank you!
Original comment by federico...@gmail.com
on 20 Dec 2012 at 3:30
Original comment by federico...@gmail.com
on 20 Dec 2012 at 3:55
Original issue reported on code.google.com by
kevin.os...@gmail.com
on 27 Feb 2012 at 2:19Attachments: