Appending to text file crashes game and editor

Hi there!

I was following a guide: [link text][1]
[1]: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums
about how to create a text file and write some simple string into it.
However only got the code working as in the guide but that way the file gets overwritten every time thus i added an else branch to my code to append to the text file but it crashes the game and the editor.

FString SourcePath = FPaths::GameSourceDir();
	FString SaveDirectory = SourcePath + "/MyProject/Trainingdata";

	FString FileName = FString("Test.data");
	FString TextToSave = ConvertVariablesToString(CanPlayerSeeAI,CanAISeePlayer,DistanceTowardPlayer,NumberOfAlliesAround,PlayersWeapon,AIWeaponType,HealthOfPlayer,AIHealth);

	bool AllowOverwriting = false;

	IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();

	// CreateDirectoryTree returns true if the destination
	// directory existed prior to call or has been created
	// during the call.
	
	if (PlatformFile.CreateDirectoryTree(*SaveDirectory))
	{
		// Get absolute file path
		FString AbsoluteFilePath = SaveDirectory + "/"+ FileName;

		// Allow overwriting or file doesn't already exist
		if (AllowOverwriting || !PlatformFile.FileExists(*AbsoluteFilePath) )
		{
			FFileHelper::SaveStringToFile(TextToSave, *AbsoluteFilePath);
		}
		else
		{
			FFileHelper::SaveStringToFile(TextToSave, *AbsoluteFilePath,FFileHelper::EEncodingOptions::AutoDetect, NULL,0x08);
		}
	}

The code works without the else branch .
Obviously i am doing something wrong.
Any idea what to do?

Solution:

Have to define

IFileManager* Filemanager = &IFileManager::Get();

Then use this instead NULL also changed the writeflag at the end

FFileHelper::SaveStringToFile(TextToSave, *AbsoluteFilePath,FFileHelper::EEncodingOptions::AutoDetect, FileManager,8);

Now with this i can append strings to my file instead overwriting its content.