Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void escreveNoFicheiroLog(char *mensagem){
- time_t rawtime;
- struct tm * timeinfo;
- time ( &rawtime );
- timeinfo = localtime ( &rawtime );
- FILE *fl = fopen("log.txt", "a");
- if (fl == NULL){
- printf("Não foi possível criar ficheiro de log");
- exit(EXIT_FAILURE);
- }
- fprintf(fl,"%d: %d: %d %s \n",timeinfo->tm_hour,timeinfo->tm_min,timeinfo->tm_sec,mensagem);
- fclose(fl);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement