Static String::formatted bug?

String test(T(“test”));
String foo = String::formatted(T("%s"), test);
String foo2 = String::formatted(T("%s"), (const char*)test);

I would have expected foo to be valid, but when it wasn’t I tried foo2. Also not valid. Is this brain fade on my part or a bug in the Juce code?



It’s not a bug, but these parameters get passed straight through to sprintf, so you need to make sure they’re the right things. Obviously sprintf wasn’t designed to understand juce String objects, so that won’t work. Casting it to a (const tchar*) is probably your best plan.