srt file
-
wrote on 10 May 2022, 08:54 last edited by
-
@jack1998 Looks like a simple text file.
What exactly is the problem? -
@jsulm 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
@jack1998 Please post your code - how else should anybody know why it does not work?
-
wrote on 10 May 2022, 09:09 last edited by VRonin 5 Oct 2022, 11:43
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"; } } }
-
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"; } } }
wrote on 10 May 2022, 09:28 last edited by JonB 5 Oct 2022, 09:30for (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.
-
@jsulm 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
wrote on 10 May 2022, 09:30 last edited bymy 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
3/7