Adding array of strings to text file line by line

#Adding String Data Line by Line

You have your core data as

FString StringData = "";

Then you add lines like this

if(StringData != "")
{
   StringData += "\n"; //newline
}

//Add new text
StringData += NextLineOfText; //can be FString or TCHAR*

then you write out the String to file using Epic’s function:

#SaveStringToFile

FFileHelper::SaveStringToFile(SaveText, * SaveDirectory);

#String Array

if you have an array of string you can use the ranged for each with your array and my code above

TArray<FString> YourData;

for(const FString& EachString : YourData)
{
  //use code above to add EachString to the total StringData.
}

#Wiki With More Info

Saving To Text Files

Rama