Added file.close() in manipulation functions (#514)

This commit is contained in:
dstoiko 2017-07-17 08:44:04 +08:00 committed by Me No Dev
parent 13bb22de30
commit d8330cceec

View File

@ -78,6 +78,7 @@ void readFile(fs::FS &fs, const char * path){
while(file.available()){ while(file.available()){
Serial.write(file.read()); Serial.write(file.read());
} }
file.close();
} }
void writeFile(fs::FS &fs, const char * path, const char * message){ 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){
} else { } else {
Serial.println("Write failed"); Serial.println("Write failed");
} }
file.close();
} }
void appendFile(fs::FS &fs, const char * path, const char * message){ 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){
} else { } else {
Serial.println("Append failed"); Serial.println("Append failed");
} }
file.close();
} }
void renameFile(fs::FS &fs, const char * path1, const char * path2){ void renameFile(fs::FS &fs, const char * path1, const char * path2){