sprintf output in quote marks

Hi,
unfortuantely i require some help getting audio output working with random-track-number filename generation. I'm using TMRpcm library, within code im generating char variable buffer which outputs in filename as it it on sdcard (eg. 1.wav) and here's where trouble begins - function tmrpcm.play(buffer) won't recognize filename because it operates on filename embedded in quotation marks [eg. tmrpcm.play("1.wav") instead of tmrpcm.play(1.wav)].

TLDR: Need help embedding sprintf output filename in quotation marks.

It's probably quite easy to solve, thought after few hours i still can't get it to work. Any help would be much appreciated.

#include <SD.h>                      // need to include the SD library
#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch

unsigned long time = 0;

void setup(){

  randomSeed(analogRead(0));
  
  tmrpcm.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
  //Complimentary Output or Dual Speakers:
   
  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    Serial.println("SD fail");  
    return;   // don't do anything more if not

  }
  else{   
    Serial.println("SD ok");   
  }
  tmrpcm.volume(1);
}


void loop(){  
  char buffer[10];
  int rand = random(1,5);
  Serial.println(rand); //debug
  sprintf(buffer,"%d.wav",rand); 
  Serial.println(buffer); //debug
  
  tmrpcm.play(buffer);
  Serial.println("-------------------------"); //debug
  delay(5000);
  
 }

"

sprintf(buffer,"\"%d.wav\"",rand);

I would be very surprised if that's the actual problem. Why would it need the file name in quotes? It doesn't need the quotes when it's a string literal. (Those quotes are not part of the string itself.)

I'd be surprised too, but that's what the OP asked for, and they didn't post any code (despite this being the programing question section) to indicate otherwise.

Whoa, thx for almost instant answers. And yes i do suck at coding, I really thought i nailed it this time, but well u were right, it didn't work as well tho output is within quotes. String var isn't working either - that was my first attempt, tho output was correct the function just didn't deliver. Still have no idea why is that, couse when i input filename directly into function it works.

there should be no difference between:

somefunc("file.txt");

and

char filename[32];
strcpy(filename, "file.txt");
somefunc(filename);

if there is, you are doing something wrong. Are you not '\0' terminated?