setftime

基本介紹

  • 中文名:setftime
  • 性質:函式
  • 功 能: 設定檔案日期和時間
  • 語言:C/C++
簡介,程式,

簡介

函式名: setftime
功 能: 設定檔案日期和時間
用 法: int setftime(int handle, struct ftime *ftimep);

程式

#include <stdio.h>
#include <process.h>
#include <fcntl.h>
#include <io.h>
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;
}

相關詞條

熱門詞條

聯絡我們