Good evening,

I write some data into a file with QDataStream.
Qt Code:
  1. QDataStream out(&file);
  2. out << quint32(magic);
  3. out << qint32(version);
  4. out.setVersion(QDataStream::Qt_4_8);
  5. for (int i = 0; i < data.size(); i++)
  6. {
  7. out << data[i].a;
  8. out << data[i].b;
  9. ...
  10. out << endl;
  11. }
To copy to clipboard, switch view to plain text mode 

Now, when reading the file from the same program; it works flawlessly.
Qt Code:
  1. QFile file(PATH + filename);
  2. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  3. return;
  4. QDataStream in(&file);
  5. in >> check_magic;
  6. if (check_magic != magic)
  7. return false;
  8.  
  9. in >> check_version;
  10. if (check_version != version)
  11. return false;
  12. in.setVersion(QDataStream::Qt_4_8);
  13. for (int i = o; i < data.size(); i++)
  14. {
  15. in >> data[i].a;
  16. ...
  17. in.skipRawData(1); // otherwise the newline makes it messy
  18. }
To copy to clipboard, switch view to plain text mode 
When I want to read the file from another program; it stops after the first iteration.
I placed a while(!(file.atEnd()) into my other program, to see how far it comes,
and it stops right after the endline.

I do not understand how that is possible, I use the same code for reading in both programs.