Quote Originally Posted by Lesiok View Post
In the first step You saved to a file memory area with size 500 * sizeof (double) from the array g1. Exactly the same load the file into memory and have data array double [500]. Do not close the file between subsequent readings.
Thanks. I used this:
Qt Code:
  1. void read()
  2. {
  3. QFile g1f, g2f, of, chf, namef;
  4. double g1[500];
  5. double g2[500];
  6. double ofse[500];
  7. int ch[500];
  8. QStringList names;
  9.  
  10.  
  11. g1f.setFileName("oneFile.th");
  12. if(!g1f.open(QFile::ReadOnly))
  13. {
  14. qDebug()<<"can not open to read";
  15. }
  16. g1f.read((char*)g1, (500)*sizeof(double));
  17.  
  18.  
  19. g2f.setFileName("oneFile.th");
  20. if(!g2f.open(QFile::Append))
  21. {
  22. qDebug()<<"can not open to read";
  23. }
  24. g2f.read((char*)g2, (500)*sizeof(double));
  25.  
  26.  
  27.  
  28. of.setFileName("oneFile.th");
  29. if(!of.open(QFile::Append))
  30. {
  31. qDebug()<<"can not open to read";
  32. }
  33. of.read((char*)ofse, (500)*sizeof(double));
  34.  
  35.  
  36. chf.setFileName("oneFile.th");
  37. if(!chf.open(QFile::Append))
  38. {
  39. qDebug()<<"can not open to read";
  40. }
  41. chf.read((char*)ch, (500)*sizeof(int));
  42.  
  43.  
  44. namef.setFileName("oneFile.th");
  45. if(!namef.open(QFile::Append))
  46. {
  47. qDebug()<<"can not open to write";
  48. }
  49. QDataStream df(&namef);
  50. df >> names;
  51. namef.close();
  52.  
  53. for(int y=0; y<500; y++)
  54. qDebug()<<ch[y];
  55. }
To copy to clipboard, switch view to plain text mode 

now i have 2 issues. it gives me this when i want to read:
QIODevice::read (QFile, "oneFile.th"): WriteOnly device
QIODevice::read (QFile, "oneFile.th"): WriteOnly device
QIODevice::read (QFile, "oneFile.th"): WriteOnly device
QIODevice::read (QFile, "oneFile.th"): WriteOnly device

and for example in "int ch[500]", after reading, ch[499] must equal to 499 but it equals to 497! what is wrong?