hi all
Qt Code:
  1. if(size==0){
  2. readD.open(QIODevice::ReadOnly);
  3. QTextStream foint(&readD);
  4. foint>>flowtime;
  5. readD.close();
  6. for(;;){
  7. this_thread::sleep_for(chrono::seconds(10));
  8. time_t now=time(0);
  9.  
  10. times.open(QIODevice::WriteOnly);
  11. QTextStream goes(&times),loint(&today);
  12. goes<<now;
  13. times.close();
  14.  
  15. double secs=difftime(now,flowtime);
  16.  
  17.  
  18. today.open(QIODevice::WriteOnly);
  19. loint<<secs<<"\n";
  20. today.close();
  21.  
  22.  
  23. }
  24. }
  25. else{
  26. qDebug()<<"is There";
  27. readD.open(QIODevice::ReadOnly);
  28. QTextStream foint(&readD);
  29. foint>>flowtime;
  30. readD.close();
  31. int seci=0;
  32. for(;;){
  33.  
  34. this_thread::sleep_for(chrono::seconds(10));
  35. engine.open(QIODevice::ReadWrite);
  36. QTextStream eng(&engine);
  37. eng<<seci;
  38. engine.close();
  39. seci+=10;
  40. if(seci==60){
  41. seci=0;
  42. today.open(QIODevice::WriteOnly | QIODevice::Append);
  43. QTextStream fps(&today);
  44. fps<<60<<endl;
  45. today.close();
  46. }
  47.  
  48. }
  49. }
  50. }
To copy to clipboard, switch view to plain text mode 
I Already Check this code The Program Will Enter Else But Only Will Not Print Message That I Write With qDebug Other Codes in Else Will Run Perfectly.