FFileHelper::LoadFileToString help

I have a file called “test.txt” in the same directory as the cpp file that contains these four lines of code. The contents of test.txt is different from the text “before” so if it reads the file successfully I would expect it to output the contents of the file to the log, however I just see “before” on the log. What am I doing wrong? What is the proper way to search for the directory?

FString fileContent = "before";
FString filePath = "test.txt";
    
FFileHelper::LoadFileToString(fileContent, *filePath);
UE_LOG(LogTemp, Warning, TEXT("%s"), *fileContent);

Thanks

Edit: The text file was added in Xcode file->new->file->blank. Maybe this is not the proper way to add a file to the project?

Hey there, my guess is that you need a full path for that to work. Check this for an example.

LoadFileToString() is a static bool method, check if the condition has been reached in a if statement, AFAIK this accept relative or full paths!