Skip to content

Commit d4ed450

Browse files
authored
Merge pull request #118 from per1234/improve-rewinddirectory-ref-code
Make `File::rewindDirectory` reference demo code more clear
2 parents 619fe19 + 0df9a9c commit d4ed450

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/api.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,13 @@ void setup() {
833833
SD.begin(10);
834834
root = SD.open("/");
835835
printDirectory(root, 0);
836+
Serial.println();
837+
838+
Serial.println("PRINT AGAIN");
839+
Serial.println("-----------");
840+
root.rewindDirectory(); // Return to the first file in the directory
841+
printDirectory(root, 0);
842+
836843
Serial.println("Done!");
837844
}
838845
@@ -845,8 +852,6 @@ void printDirectory(File dir, int numTabs) {
845852
File entry = dir.openNextFile();
846853
if (!entry) {
847854
// No more files
848-
// Return to the first file in the directory
849-
dir.rewindDirectory();
850855
break;
851856
}
852857

0 commit comments

Comments
 (0)