Creating a custom file name for SD files

Hello

I have written the following code to let the user choose which file they wish to write data to. I am having problems with setting filename equal to the data read from the serial port because of incompatible types. How can I convert the serial port message to the same type as filename?

Thanks

The error message I am having is : incompatible types in assignment of 'int' to 'char[5]'

  Serial.println("Please enter a file name to write data to"); 
  char filename[5];
  filename = (Serial.read());
  
  myFile = SD.open(filename, FILE_WRITE);
 char filename[5];
  filename = (Serial.read());

Serial.read returns a single "int", yet filename is a char array.
The compiler is quite right; you can't do that.
If you want to read a string, you have to do it one character at a time.