Skip to content

Commit 55cd20f

Browse files
committed
Print the card file structure twice in rewindDirectory reference code
`File::rewindDirectory` is used to reset the current position in the file system. Previously, the file structure was only iterated over once, in which case rewinding is not necessary and will have no observable effect. In the following sequence, it is necessary and does have an observable effect: 1. Iterate over file structure using `File::openNextFile` 2. Reset current position using `File::rewindDirectory` 3. Iterate over file structure using `File::openNextFile` The reader can simply remove the `File::rewindDirectory` call from the program that follows this sequence for a clear demonstration of its purpose.
1 parent 615568f commit 55cd20f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/api.md

+5
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,12 @@ 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("-----------");
836840
root.rewindDirectory(); // Return to the first file in the directory
841+
printDirectory(root, 0);
837842
Serial.println("Done!");
838843
}
839844

0 commit comments

Comments
 (0)