I am saving the contents of several variables using QDataStream.

Qt Code:
  1. out << objWidth << "\n" << objHeight << "\n";
To copy to clipboard, switch view to plain text mode 

Where objWidth and objHeight are a single byte (unsigned char, value from 0 to 255).

then it outputs another series of bytes from a vector

Qt Code:
  1. for(int i = 0; i < objWidth; i++)
  2. {
  3. for(int j = 0; j < objHeight; j++)
  4. {
  5. byte value = getCellValue(i, j);
  6. out << value << ",";
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 


Then it does it again after separating data with a new line character with another vector of data, the exact same dimensions, only different data, but same statement.

so the whole file would look like:

Qt Code:
  1. objWidth
  2. \n
  3. objHeight
  4. \n
  5. Vector1 data each element separated with a comma
  6. \n
  7. Vector2 data each element separated with a comma
To copy to clipboard, switch view to plain text mode 

Now when I read this data back from a file using QDataStream, do I want to process it directly from a file, or read it into QByteArray so I can process it there, removing new lines and commas etc?

Which is easier?