sprintF() Add a varible to the function troubles

Probably a nother Nube question, but First time using sprint(), and now I want to create a new void and this requires the creation of a variable to pass the "filename" to the new void routine. I think I'm mixing oil and water. A little help please. Thanks

SampleName="Test"

  
 String fName=  SampleName + ".txt"; 
           
   sprintf(MyFileN, fName);  //Creates Savedata filename  for SD

Error: cannot convert 'String' to 'const char*' for argument '2' to 'int sprintf(char*, const char*, ...)'
or

   sprintf(MyFileN, SampleName + ".txt");  //Creates Savedata filename  

Error :cannot convert 'StringSumHelper' to 'const char*' for argument '2' to 'int sprintf(char*, const char*, ...)'

sprintf() does not support the String object.

You can’t use the String class with sprintf. You have to stick to c-style strings, null terminated char arrays.

sprintf expects a format string to tell it where to put things. What are you trying to accomplish? Post the whole code, you’ve obviously got something horribly confused. If you just want the file name in a char array, then just start out with it there. There’s no reason to create a String just to extract the char array out of it when you can just start with a char array.