Programmer en Lang. C

Bonjour,

je veux sauvegarder la date courant de systeme dans un fichier, pour cela j'ai fais se petite programme mais pleins d'erreur:

/* ctime example */
#include <stdio.h>
#include <time.h>
#define SOURCE "source.txt"

int main ()
{
FILE * f = NULL ;
f = fopen(SOURCE,"a+");
time_t rawtime;

time ( &rawtime );
fprintf (f, "The current local time is: %s", ctime (&rawtime) );

return 0;
}

j'ai besoin d'aide

merci d'avance

2 réponses

  1. Modérateur
    
    johand@osiris:~/src/ccm$ cat ./affich-20946529-programmer-en-lang-c.c
    /* ctime example */
    #include <stdio.h>
    #include <time.h>
    #define DESTINATION "destination.txt"
    
    int main(int argc, char *argv[])
    {
      FILE * f = NULL ;
      f = fopen(DESTINATION,"a+");
      time_t rawtime;
    
      time ( &rawtime );
      fprintf (f, "The current local time is: %s\n", ctime(&rawtime) );
    
      return 0;
    }

    0
    1. Modérateur
      Voir plus bas
      Gates gave ^H sold you the windows.
      GNU gave us the whole house.(Alexandrin)
      0