Search code examples
c++stringunreal-engine4data-conversion

How do I convert a UE4 FString into a string?


TextLine2 needs to be a regular string however I receive the error no instance of constructor matches the argument list.

void AAH_Ver1_2::GetEachTextFromLine(FString TextLine1)
{
    string TextLine2 = TextLine1;
    istringstream iss(TextLine2);
}

Solution

  • You can convert an FString to an std::string with the TCHAR_TO_UTF8 macro:

    std::string const s = TCHAR_TO_UTF8(*fstring);