Sd2Card and SdFat in same sketch.

I am trying to figure out how to init/begin instance of the Sd2Card and SdFat in the same sketch. Presently I have:
sd.begin(CS_SD_PIN, SPI_FULL_SPEED) for SdFat
card.begin(CS_SD_PIN, SPI_FULL_SPEED) for Sd2Card.

This works but seems redundant.

I believe Sd2Card* SdFat::card() is the answer but I can not figure how "passing the pointer" allow access to both SdFat and Sd2Card.

I searched the forum and web and I only found the following:
Sd2Card *card = sd.card();

But this does not work for what I am trying to accomplish

This works but seems redundant.

Yes, you should not have two instances of Sd2Card. You should be able to use sd.card().

Here is an example for read() but it will work with any Sd2Card member function.

Instead of

  if (!card.read(lbn, buf)) {
    // handle error
  }

Use this

  if (!sd.card()->read(lbn, buf)) {
    // handle error
  }

But this does not work for what I am trying to accomplish

Why not?

In your code example is card Sd2Card or SdFat?

if (!card.read(lbn, buf)) {
// handle error
}

In my sketch I am using from SdFat:

exists
ls
mkdir
remove
chdir

So would sd.exists become sd.card()-> card.exists?

Or for example would I use sd.card()->card.cardSize()?

In my sketch I am using from SdFat:

exists
ls
mkdir
remove
chdir

These are all member functions of SdFat, not Sd2Card. Sd2Card is the class for raw access to the SD card. SdFat contains an instance of Sd2Card for raw block level access to the SD.

Why do you need the Sd2Card class? What do you mean by this statement?

But this does not work for what I am trying to accomplish

My application is normally stand alone but can interface to a PC to allow the user to configure it.

My sketch has the ability to upload and download data, and the necessary control files using a VBA macro on my PC.

I want to be able to format the SD card within the sketch then the with handshaking with the VBA macro it will reupload the necessary files to the SD card and reinitialize with the new files.

I want to be able to format the SD card within the sketch then the with handshaking with the VBA macro it will reupload the necessary files to the SD card and reinitialize with the new files.

Why do you need to format the SD in your sketch?

Ease of usage for the end user.

I have put a lot of work into PC to micro communication so the end user does have have to use sneaker net with the SD card.

I would be much easier to plug in a USB cable the click a button.

BTW, I am using a 1284P so flash and ram are not an issue.

Ease of usage for the end user.

I have put a lot of work into PC to micro communication so the end user does have have to use sneaker net with the SD card.

I would be much easier to plug in a USB cable the click a button.

I still don't see why you need to format the SD in a sketch.

So the user does not need to remove it.

So the user does not need to remove it.

You don't need to format the SD each time you use it. Start with a formatted card.

You can delete or rewrite any files as needed. SdFat has a function to delete all files on the card if you wish.