Announcement

Collapse
No announcement yet.

LoadFileToString always blank. Need Help.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Code:
     
    #include "RWTxtFile.h" #include "Misc/Paths.h" #include "Misc/FileHelper.h" FString filePath = "E:\\myfile.txt";
    FString URWTxtFile::ReadFString() { FString fileText = ""; FFileHelper::LoadFileToString(fileText, *filePath); UE_LOG(LogTemp, Warning, TEXT("%s"), *fileText); return fileText; }
    bool URWTxtFile::ReadBool(FString& result) { return FFileHelper::LoadFileToString(result, *filePath); }
    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.
    Last edited by SkeetonYu; 11-10-2019, 11:27 AM.
    Checkout Project "TwinBlaster" my current game in progress.
    [FREE] - 2D ROPE! Find out more here!
    Forgive my username... It's an old game name and wrote it down as a habit.

    #2
    Use IFileManager to check if a file exists.

    Code:
    bool bExists = IFileManager::Get().FileExists(*filePath);
    
    FFileStatData StatData = IFileManager::Get().GetStatData(*filePath);

    Comment

    Working...
    X