Converting a float to a char* for writing to SD card

Hello so I'm trying to convert a float to a char* to write to an SD card. Here's a simplified example. The problem is that it won't print the float to the SD card, instead it prints two question marks.

float new_money = 1.0;
char new_money_char[10];
File cust_file;

void setup(){
sprintf(new_money_char, "%f", new_money);
cust_file ="file.txt", FILE_WRITE);

void loop(){

Any help would be appreciated, thank you!


Why do that? You can print float to SD.

cust_file ="file.txt", FILE_WRITE);

should work.

Thank you so much to both of you. The solutions that you gave worked just fine and were very helpful!
Once again, Thank You so much!

I'm pretty new to Arduino but I utterly fail to see why you would ever need to convert float to string either. It is probably just as dumb as converting it to char.

I note the file date and that article may have been valid for an earlier version of Arduino, but surely it has no relevance in current versions. You don't have to convert float to anything, so why would you do it? I submit all such a conversion gives you is a definite waste of time and a probable source of grief.