While I can’t teach you how to code in CPP in a UE4 answers comment, I can give some snippets. There are tons of programming guides on the UE4 help site and forums to get started with UE4 programming.
I assume you want this generally available in your project, so you need to add this to a Blueprint function library. In the header file of the class you made, first extend your class by UBlueprintFunctionLibrary (replacing UMyBlueprintLibrary with your class name):
UMyBlueprintLibrary : public UBlueprintFunctionLibrary
You might need to add “#include “Kismet/BlueprintFunctionLibrary.h”” before the other includes if it moans about UBlueprintFunctionLibrary.
In the “public:” section, create a new UFUNCTION like so:
UFUNCTION(BlueprintCallable, Category="Game Config")
static FString GetAppVersion();
Then in the CPP file, create the actual function:
FString UMyBlueprintLibrary::GetAppVersion() {
FString AppVersion;
GConfig->GetString(
TEXT("/Script/EngineSettings.GeneralProjectSettings"),
TEXT("ProjectVersion"),
AppVersion,
GGameIni
);
return AppVersion;
}