Carriage return [Solved]

Hello community,

I am using this code to write logs in a custom file

IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
IFileHandle* FileHandle = PlatformFile.OpenWrite(*LogsFileName, true); // append mode
if (FileHandle)
{
	FileHandle->SeekFromEnd(0); // end of file
	FileHandle->Write((const uint8*)TCHAR_TO_ANSI(*MyText), MyText.Len());
	delete FileHandle; // close file
}

All works fine but I can not write MyText on a new line. \n does not work.

Some one knows the code to write on the next line ?

Thanks.

Niarks

The line endings differ for different systems. In windows I think it is “\r\n”. In Linux it is just “\n”. I don’t know about mac but you can find that information out there pretty easy. So unless EPIC build in some cross platform features for endline which I don’t know if they have, you may need to check which platform you are on to add correct line endings.

Thanks, I have tested /r and /n separately, never together.

It works correctly now.

Thanks again.

Glad I could help!