Are you adding QIODevice::Text to the OpenMode? If you want newlines in the output, you have to explicitly write them if you are using QIODevice directly to write the files:

Qt Code:
  1. iodevice.write( mystring );
  2. iodevice.write( "\n" );
To copy to clipboard, switch view to plain text mode 

But for text files, it is more usual to create a QTextStream and a QFile and use that combination to write and read text data:

Qt Code:
  1. // Writing:
  2.  
  3. QFile file("out.txt");
  4. if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
  5. return;
  6.  
  7. QTextStream out(&file);
  8. out << mystring << "\n";
  9.  
  10. // Reading:
  11. QFile file("in.txt");
  12. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  13. return;
  14.  
  15. QTextStream in(&file);
  16. while (!in.atEnd()) {
  17. QString myString = in.readLine(); // readline automatically removes the EOL
  18. // do something with "mystring"
  19. }
To copy to clipboard, switch view to plain text mode