Read filename from SD card, store to a string

Currently I do this

// open next file in root.  The volume working directory, vwd, is root
  while (sdCardFile.openNext(sdCard.vwd(), O_READ)) 
{
  MaxFiles++;
    
  sdCardFile.close();
}

which is mostly extracted from one of the examples.
So it just increments through all the files in root, and adds 1 to the count. I then get the total file count out at the end.

Its this I want to extend on, so not only get the file count, but get a list of ints, of all the files present in root.

Cheers