FString CompleteFilePath = "G:\saves\map.txt";
if (!FPlatformFileManager::Get().GetPlatformFile().FileExists(*CompleteFilePath))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("Could not Find File"));
return;
}
const int64 FileSize = FPlatformFileManager::Get().GetPlatformFile().FileSize(*CompleteFilePath);
//if not in player controller use UE_LOG. ClientMessages show up if you press ~ in-game
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("File Size is:"));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::FromInt(FileSize));
i got Following Error:
error C2220: warning treated as error - no object file generated
For others who are also Searching for a Solution, the Read Code :rolleyes:
FString CompleteFilePath = "G:\\saves\\map.txt";
if (!FPlatformFileManager::Get().GetPlatformFile().FileExists(*CompleteFilePath))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("Could not Find File"));
return;
}
const int64 FileSize = FPlatformFileManager::Get().GetPlatformFile().FileSize(*CompleteFilePath);
//if not in player controller use UE_LOG. ClientMessages show up if you press ~ in-game
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::FromInt(FileSize));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("File Size is: (in kb)"));
FString FileData = "TEST";
FFileHelper::LoadFileToString(FileData, *CompleteFilePath);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FileData);