aboutsummaryrefslogtreecommitdiffstats
path: root/append.c
blob: 0b2bbbb229da9a144cfe1f08f28564355ff5514b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>

int main(int argc, char *argv[]) {

 time_t t = time(NULL);
 struct tm tm = *localtime(&t);
 FILE *fp;
 fp=fopen("append.txt", "a+");

 fprintf(fp,"%d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
 fprintf(fp,"%d\n", ((int) t)/60*60);
 fclose(fp);

 return 0;
}