Skip to content

Commit 217cbbc

Browse files
dstoikoRaienryu97
authored andcommitted
Added file.close() in manipulation functions (espressif#514)
1 parent 039664c commit 217cbbc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: libraries/SD/examples/SD_Test/SD_Test.ino

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void readFile(fs::FS &fs, const char * path){
7878
while(file.available()){
7979
Serial.write(file.read());
8080
}
81+
file.close();
8182
}
8283

8384
void writeFile(fs::FS &fs, const char * path, const char * message){
@@ -93,6 +94,7 @@ void writeFile(fs::FS &fs, const char * path, const char * message){
9394
} else {
9495
Serial.println("Write failed");
9596
}
97+
file.close();
9698
}
9799

98100
void appendFile(fs::FS &fs, const char * path, const char * message){
@@ -108,6 +110,7 @@ void appendFile(fs::FS &fs, const char * path, const char * message){
108110
} else {
109111
Serial.println("Append failed");
110112
}
113+
file.close();
111114
}
112115

113116
void renameFile(fs::FS &fs, const char * path1, const char * path2){

0 commit comments

Comments
 (0)