How to open a file on an SD Card

I think this is probably a silly question but I’m afraid I don’t know the answer……

Why does this Sketch compile OK

#include <SPI.h>
#include <SD.h>

File dataFile;

void setup() {

  pinMode(SS, OUTPUT);

  SD.begin(10, 11, 12, 13);

  dataFile = SD.open("12345678.txt", FILE_WRITE);

}

void loop() {}

but this one doesn’t?

#include <SPI.h>
#include <SD.h>

String todayFilename;
File dataFile;

void setup() {

  pinMode(SS, OUTPUT);

  SD.begin(10, 11, 12, 13);

  todayFilename = "12345678.txt";
  dataFile = SD.open(todayFilename, FILE_WRITE);

}

void loop() {}

Apologies for my ignorance.

Cheers.

 dataFile = SD.open(todayFilename, FILE_WRITE);

Because Sd.open accepts a string, but not a String as a filename

AAARRRGGGHHHHH!!!

The dreaded string vs String.

Many thanks AWOL, I have yet to get my head around Strings and strings properly.

You made my day.

Cheers.