Erm the code firs :} :
Code:
#include <stdio.h>
#include <utmp.h>
#include <string.h>
#include <time.h>
int main( )
{
struct lastlog vsebina_lastloga ;
FILE *datoteka ;
if ((datoteka = fopen("/var/log/lastlog", "r+")) == NULL)
{
fprintf(stderr,"Napaka pri odpiranju datoteke\n");
return (9);
}
struct tm faketime ;
faketime.tm_sec = 40;
faketime.tm_min = 54;
faketime.tm_hour = 21 ;
faketime.tm_mday = 12 ;
faketime.tm_mon = 3;
faketime.tm_year = 304 ;
faketime.tm_wday = 5 ;
faketime.tm_yday = 300 ;
datoteka = fopen("/var/log/lastlog", "r+") ;
fread(&vsebina_lastloga, sizeof(struct lastlog), 1, datoteka);
printf("%s\n%s\n" , asctime(&faketime), ctime(&vsebina_lastloga.ll_time)) ;
fclose(datoteka) ;
return 0 ;
}
Now what i don't understand is how can this printf " printf("%s\n%s\n" , asctime(&faketime), ctime(&vsebina_lastloga.ll_time)) " prints two IDENTICAL values like this :
bash-2.05b# ./a.out
Fri Apr 12 21:54:40 2204
Fri Apr 12 21:54:40 2204
Can somebody explain me how can this succede ?