#ifndef __head_h__
#define __head_h__
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include <unistd.h>
typedef struct
{
char name[20];
char psw[20];
}use;
#endif
#include"head.h"
// vsp xxx
int main(int argc, const char *argv[])
{
time_t t1 =time(NULL),t2;
struct tm *info=NULL;
/* printf("%4d-%02d-%02d %02d-%02d-%02d\n",\
info->tm_year+1900,info->tm_mon+1,
info->tm_mday,info->tm_hour,\
info->tm_min,info->tm_sec);
输出例句*/
FILE *fp=fopen("time.txt","a+");
while(1)
{
sleep(1);
time(&t2);
info = localtime(&t2);
fprintf(fp,"%4d-%02d-%02d %02d-%02d-%02d\n",info->tm_year+1900,info->tm_mon+1,info->tm_mday,info->tm_hour,info->tm_min,info->tm_sec);
fflush(fp);
}
}