How to run Stat Startfile console command in C++?

Hey, guys

I want to call the console command Stat Startfile from c++. However, when I use FString startfile = "STAT STARTFILE"; GetWorld()->Exec(GetWorld(), *startfile);, the engine is crashed.
Could you guys please teach me how to run the command like Stat Start/StopFile in the C++?

Thanks
Bests
YL

You need use player controller:
Example in Character:

APlayerController* PC = GetPlayerController(this);
if(PC)
{
    PC->ConsoleCommand(TEXT("stat startfile"), true);
}