Save TArray to text file

I’m trying to write a class that will need to write an array of strings to a text file and also read from that same file. I’ve done some debugging and have no idea what’s wrong with it. I tested it with a SaveStringToFile and that worked, but I need to save the array. Here is the function:

.h

FString dataPath = “testArray.txt”;
TArray currentData;

.cpp

void ALeapNeuralNet::SaveFile()
{
	FString len = FString::FromInt(currentData.Num());
	UE_LOG(LogTemp, Warning, TEXT("Length of data array: %s"), *len);
	bool success = FFileHelper::SaveStringArrayToFile(currentData, *dataPath);
	FString result = success ? ("Successful") : ("Failed");
	UE_LOG(LogTemp, Warning, TEXT("Saved File: %s"), *result);
	FString dir = FPaths::ProjectDir() + dataPath;
	UE_LOG(LogTemp, Warning, TEXT("Saved to: %s"), *dir);
}

Output:

Length of Array: 80
Saved File: Successful
Saved to: Expected Location

have you searched for the file?

reading over the code I would expect it to land somewhere else since you are not using dir to save it

	const FString OutputDirectory = FPaths::Combine(*FPaths::ProjectDir(), TEXT("Saved"), TEXT("TimedDataMonitor"));
	const FString Filename = TEXT("SomeName")
	const FString FullyQualifiedFileNameFilename = FPaths::Combine(OutputDirectory, Filename);
	FFileHelper::SaveStringArrayToFile(Item.Value.Entries, *FullyQualifiedFileNameFilename);

example modivied from unreal code in
void UTimedDataMonitorSubsystem::UpdateStatFileLoggingState()