check SD card from function

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.


What is the meaning the number four in this line-> if (!SD.begin(4))
Could it change?

That is the pin number of the pin connected to the Slave Select input on the SD card SPI interface.

Yes, you can use a different pin for Slave Select. You just have to wire the SD card to the new pin.

thanks for your comments , do You know about of check the SDcard not only at the begin of program , I want to check each time call from function

thanks and sorry my Englishis not good.

What do you mean by "check the SD card"? Do you mean "see if the SD card is still there"?

I think you can call SD.begin() as often as you like. You should probably close any open files before you do that.