Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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);


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?

Product Version: UE 4.18
more ▼

asked Jan 22 '18 at 12:57 AM in C++ Programming

avatar image

1 1 2

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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

more ▼

answered Jan 22 '18 at 01:00 AM

avatar image

6k 159 127 303

(comments are locked)
10|2000 characters needed characters left

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

more ▼

answered Jan 22 '18 at 02:19 AM

avatar image

376 9 12 18

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question