Added file.close to examples (#3611)
This commit is contained in:
parent
ac9d04a400
commit
cd85239252
@ -52,6 +52,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){
|
||||||
@ -67,6 +68,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){
|
||||||
@ -82,6 +84,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){
|
||||||
|
@ -50,6 +50,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){
|
||||||
@ -65,6 +66,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){
|
||||||
@ -80,6 +82,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){
|
||||||
|
Loading…
Reference in New Issue
Block a user