SD card fails to open file to write after a day of use

Hi all,

I am sorry for the late reply. I have been troubleshooting the SD shield lately and it has continued to work for a week. I am no programming or Arduino expert. But here is what i have done in the code to solve it. I hope it helps even if it may not make sense. :smiley:

myFile=SD.open("test.txt");
if(myFile){
Serial.println("test.txt:");
if(myFile.available()){
Serial.write(myFile.read());
}
myFile.close();
}
else {Serial.println("error opening test.txt");}

The code does nothing new but after each write, it reads the SD card. In doing so, the SD card seems to be able to communicate with Arduino without problems. Thank you for everyone's inputs!