hi, what is the meanign the number four in this line ---if (!SD.begin(4))--- Could it change?
I am using arduino ethernet
how you can do if do you want to know the SD card is not failed . Not only at the begin of program , also when you call from a function each time that you need and check that you do not have a problems with SD card for example: It was broken or not right in its place.