[Time] Problème pour récupérer la date courante
Bonjour a tous !!
J'ai un petit soucis avec le code suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
/* int choix = 10; */
time_t date;
struct tm *time;
char *stringdate;
stringdate = malloc (sizeof(char) * 10);
if (stringdate == NULL)
{
perror("Erreur allocation memoire chaine de caracteres ! \n");
return EXIT_FAILURE;
}
time = malloc(sizeof(struct tm));
if (time == NULL)
{
perror("Erreur allocation memoire structure time ! \n");
return EXIT_FAILURE;
}
time(&date);
time = gmtime(&date);
strftime (stringdate, 10, "%d%m", time);
printf("Nous sommes le %s", stringdate);
return EXIT_SUCCESS;
} |
Mon compilo me dit ça :
Citation:
called object is not a function (a la ligne : time(&date) )
Alors voila je comprend pas, j'ai regardé la FAQ pour voir comment on se sert de la fonction time et voilou . . .
Merci d'avance ^^