setftime
函数名: setftime 功 能: 设置文件日期和时间 用 法: int setftime(int handle, struct ftime *ftimep); 程序例: #include #include #include #include int main(void) { struct ftime filet; FILE *fp; if ((fp = fopen("TEST.$$$", "w")) == NULL) { perror("Error:"); exit(1); } fprintf(fp, "testing...\n"); /* load ftime structure with new time and date */ filet.ft_tsec = 1; filet.ft_min = 1; filet.ft_hour = 1; filet.ft_day = 1; filet.ft_month = 1; filet.ft_year = 21; /* show current directory for time and date */ system("dir TEST.$$$"); /* change the time and date stamp*/ setftime(fileno(fp), &filet); /* close and remove the temporary file */ fclose(fp); system("dir TEST.$$$"); unlink("TEST.$$$"); return 0; }