Append to text file instead of overwrite whats there?
Hello! I have been following Rama's tutorial on how to write to a text file from UE. ( link ) It is a very helpful walkthrough, but I am wondering if there is a way to append to the text file instead of writing over what is already there. I have been writing to the file every 10 seconds and make sure to print my the RunTime so I can see that it is indeed overwriting what is currently there. (Spoiler: it is)
The code below has been writing a single line to the file, overwriting what is already there.
The code below is able to write the string twice on the same line, but I was reading that I have to delete the file handle before quitting my program. Is there an "OnQuit" function available where I can delete it?
Also, my string has a \n in it but doesn't seem to add a new line.. is there something else I have to add?
All help is greatly appreciated!
asked Jun 30 '15 at 01:15 AM in C++ Programming
Hello, FFileHelper::SaveStringToFile() has 5 arguments:
Last three of them are not obligatory, but you can use them if you need more custom setup. The last parameter is WriteFlags, there are several of them defined in FileManager:
To append you can use FILEWRITE_Append. Here is the example of call for append: **FFileHelper::SaveStringToFile(StringToSave, PathToFile, FFileHelper::EEncodingOptions::AutoDetect, &IFileManager::Get(), EFileWrite::FILEWRITE_Append)*
Follow this question
Once you sign in you will be able to subscribe for any updates here