std::string

Hey, have a problem with C++
For some reason there is a problem wiht std::string as a returning value in h file. I can’t figure it out for weeks now, what am I doing wrong?


Don’t use std::string directly in function unreal returns. Use FString the unreal wrapper for it.
You seem to basically want to return a string value of the passed in int correct?

There is already a function for this in unreal

calling:

FString::FromInt(firstInt);

will get you a string built based on the passed in integer

if you want to do some extra work with the string, add a prefix, suffix you can use

FString::Printf(TEXT("%d"), firstInt);

editing the text portion to more robustly reflect the outcome you need.

1 Like

Thank you for the answer!
Actually I was trying to get the hieroglyphs through the steam advanced session plugin using the session property. But inside the engine there is an encoding problem (I got the ??? on the output) so I’ve thought about sending the numbers.
“Get character as number” gives me the number of the character (of the ASCII table I guess). And I’ve tried to make a reverse. Get the char from the int (using the same encoding table). It seems it’s impossible…
Anyway thank you! Would not use std::string directly in returns

Maybe this thread might help?

If you are losing information regarding encoding

Again thank you for the answer, this is the best for this post!
And I finally resolved my problem, if it will be intresting for anyone