srt file
-
int minute = 0; int heure = 0; int seconde = 0; QString note = QDateTime::currentDateTime().toString(QString("'%1/fichier_note_'dd-MM-yyyy'.str").arg(dossier)); QFile filenote(note); filenote.open(QIODevice::Append | QIODevice::Append); QTextStream commentaire (&filenote); for (heure=0;heure<=24;heure++) { for (seconde =0;seconde<60;seconde++) { seconde++; heure=0; minute=0; commentaire<<heure<<":"<<minute<<":"<<seconde<<"\n"; if (seconde==59) { minute++; seconde = 0; heure =0; commentaire<<heure<<":"<<minute<<":"<<seconde<<"\n"; } if (minute == 59) { heure++; minute=0; seconde =0; commentaire<<heure<<":"<<minute<<":"<<seconde<<"\n"; } } }
-
for (heure=0;heure<=24;heure++)
{
for (seconde =0;seconde<60;seconde++)
{
seconde++;
heure=0;
minute=0;Please use the Code tag (
</>
from the toolbar) when posting code.This seems to be a loop for every second --- **why?? ** --- which resets
heure
&minute
to0
--- why?? --- as well as incrementseconde
which the loop is incrementing too --- why??.Fix your basic C++ algorithm for whatever you are trying to achieve. I have no idea what you are trying to achieve/thinking you are achieving.
-
my file is always between 0 and 60s it means that I have 00;00;60 the next instruction is 00;00;01 and not 00;01;00
There is no 60th second... Seconds go from 0 to 59. The 60th second is 1 minute (01:00)
Just restart everything after you get to one minute so you start counting from 00:00,000 again