Newline, GPX, and cross-platform

  • I am working on a Linux computer with Qt 5.xx. I want to write an XML file with my Linux computer but I need to use Windows newline characters. Is there any way to tell Qt to use Windows newlines when writing my XML file from a Linux computer? Probably something simple that I can't find in the docs?

  • welcome to fourm. If you are planning to read/write using qt across the platform, you don't to worry much. You need to open the file using QIODevice::text mode. It will work according to local encoding. If you are file is ready by other software, you need to explicitly write windows format. I don't think there is direct way do dump like windows format.

  • My program writes good XML files with Linux newlines. For it to be readable by Windows, eg BaseCamp, sounds like I need to write a program that reads my XML file and writes one with Windows newlines, and then try to remember which ones have been "windowfied". and which ones still are Linux. This sounds like a dreadful kludge to me. As my Linux has no problem with using crlf terminated lines, I would like to generate only crlf lines.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.