in the examples from the (official) SD library, understanding FIle and card.init

I was trying out the ReadWrite example of the SD official library. Line 24 is File myFile;

Is the File command part of the library? I couldn't find it in the documentation. Is there another page? I seem to remember being warned not to use Format... from the Windows context menu, and to instead use the program from the SD association to format the cards. The SD Card Notes page doesn't mention this and I can't remember where I read it.

Also, the CardInfo example has on line 50 if (!card.init(SPI_HALF_SPEED, chipSelect)) {
The documentation doesn't mention card.init() either

So, my question: Is there anything I need to know about the File command? Is card.init() documented? Are there other undocumented commands out there?

File is not a command. It a datatype, a class that inherits from Stream. It's declaration is in SD.h.

init() is a member function of the Sd2Card class. It's declaration is in Sd2Card.h.

Thanks, I found SD.h and had a look but I couldn't make sense of it. At least I now know where "undocumented" code can be found.
I couldn't find Sd2card.h I assume it's on my PC and doesn't need to be installed since I have the example which uses init() I'll do a search in file explorer later.
Thanks again for the heads up, you solved a mystery for me!

Beavis4ever:
I couldn't find Sd2card.h

Try in ...\libraries\SD\src\utility

Don't Format SD cards with OS utilities!

@gfvalvo Thanks, turns out that I have more than one location of the Library folder. I was finally able to find Sd2card.h

@dannable Thanks, there's no way I was gonna remember where I saw that.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.