What is the best way of manipulating strings and using them as void*?

I’m trying to communicate some strings over Bluetooth that contains some float variables. The code looks something like this:

string message = string1+ to_string(float1) + string2 + to_string(float2) + "\n";
blutooth.write( message.c_str(), message.size());

But it shows “%f” instead of the float values. How can I make it 1. work and maybe 2. less convoluted? How is it meant to be done? This is something I’ll be very frequently doing in my projects.

Hello,

I am not sure from where you see “%f” but try to check this page.

BR, Jan

you can try the std::string_view. It works well with BufferedSerial or UnBufferedSerial.
std::string message= message = string1+ to_string(float1) + string2 + to_string(float2) + “\n”;
std::string_view buff(message);
blutooth.write(buff.begin(), buff.size());

Where is the file mbed_app.json? Do I have to create it? Where?

If you not have it, then just create it in project folder.

BR, Jan

I Did that, but same problem. However, thanks for telling me about the string_view. I’ll use it from now on.

Yes. That fixed it.