Download

LoadFileToString always blank. Need Help.

I tried two methods to get this working (ReadFString and ReadBool) but it always result in blank. I’m sure im doing something wrong here and need help.
Here is my CPP file.


 [HR][/HR]#include "RWTxtFile.h"
#include "Misc/Paths.h"
#include "Misc/FileHelper.h"

FString filePath = "E:\\myfile.txt"; [HR][/HR]FString URWTxtFile::ReadFString()
{
FString fileText = "";
FFileHelper::LoadFileToString(fileText, *filePath);
UE_LOG(LogTemp, Warning, TEXT("%s"), *fileText);
return fileText;
} [HR][/HR]bool URWTxtFile::ReadBool(FString& result)
{
return FFileHelper::LoadFileToString(result, *filePath);
} [HR][/HR]


I been stuck on this for a while. I also added Rama Victory Plugin and it results is always blank. Using VS 2019 with latest toolchain. Tried on 4.22 and 4.23.

Use IFileManager to check if a file exists.




bool bExists = IFileManager::Get().FileExists(*filePath);

FFileStatData StatData = IFileManager::Get().GetStatData(*filePath);