'How can I pass a string through sprintf()?
I'm making a mod to a old single player game that will show you the names of the AI. I'm trying to convert the wchar_t(FText) to a string and pass it through the sprintf, for some reason this code doesn't work:
wchar_t* displayName = smthg->smthg.name.Get(); // Name Location in FText
wstring wsText(displayName); // Converting it to wstring
string str(wsText.begin(), wsText.end()); // Converting it to string
char buf[0x16];
sprintf(buf, str.c_str()); // Trying to put it in sprintf
Output: Nothing
I also tried using:
sprintf(buf, "%s", str);
Output: Nothing
Could someone explain me why does this not work?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
