Bonjour
j'ai fait un petit code pour lancer un programme toutes les 30 secondes.
Lorsque je lance le débugger, ça marche nichel.
Mais lorsque je lance le programme tout seul ça merde.
C'est une fonction récurcive qui pour l'instant est censée me dire quand les 30 secondes sont écoulées.
merci de votre aide
yeager
#include <stdio.h>
#include <winsock2.h>
#include <conio.h>
#include <time.h>
void test_fonction_temps()
{
time_t instant_initial = 0;
instant_initial = time (NULL);
if (instant_initial == ((time_t) - 1))
{
fprintf(stdout,"erreur d'horloge");
}
else
{
fct_temps(instant_initial);
}
}
void fct_temps(time_t instant_initial)
{
char saisie = 0;
time_t instant_final;
double ecart=0;
instant_final = time (NULL);
if (instant_final == ((time_t) - 1))
{
fprintf(stdout,"erreur d'horloge");
getch();
}
else
{
ecart = difftime(instant_final,instant_initial);
if (ecart >= 30)
{
fprintf(stdout,"cela fait trentes secondes");
getch();
}
else
{
fct_temps(instant_initial);
}
}
}
void test_fonction_temps()
{
time_t instant_initial = 0;
instant_initial = time (NULL);
if (instant_initial == ((time_t) - 1))
{
fprintf(stdout,"erreur d'horloge");
}
else
{
fct_temps(instant_initial);
}
}
void main()
{
test_fonction_temps();
}