如何分析他人网站流量,c2c电子商务的特点,企业文化设计,电商网站开发实战视频教程思维导图#xff1a; 练习#xff1a;
1将当前的时间写入到time. txt的文件中#xff0c;如果ctrlc退出之后#xff0c;在再次执行支持断点续写
1.2022-04-26 19:10:20
2.2022-04-26 19:10:21
3.2022-04-26 19:10:22
//按下ctrlc停止#xff0c;再次执行程序
4.2022…思维导图 练习
1将当前的时间写入到time. txt的文件中如果ctrlc退出之后在再次执行支持断点续写
1.2022-04-26 19:10:20
2.2022-04-26 19:10:21
3.2022-04-26 19:10:22
//按下ctrlc停止再次执行程序
4.2022-04-26 20:00:00
5.2022-04-26 20:00:01
#include head1.h
int main(int argc, const char *argv[])
{FILE* fpfopen(./time.text,r);if(fpNULL){PRINT_ERROR(error);}
/* int i1;while(1){int ch fgetc(fp);if(chEOF){break;}if(ch10){i;}}
*/int ifgetc(fp);i; while(1){time_t rec;time_t restime(rec);struct tm *tlocaltime(rec);if(NULLt){PRINT_ERROR(error);}printf(%d.%d-%d-%d %02d:%02d:%02d\n,i,t-tm_year1900,t-tm_mon1\,t-tm_mday,t-tm_hour,t-tm_min,t-tm_sec);fputc(i,fp);rewind(fp);sleep(1);}return 0;
}
运行结果 2.使用fwrite和fread函数实现图片的拷贝
#include stdio.h
#include string.h
#include stdlib.h
#include head1.h
int main(int argc, const char *argv[])
{FILE* fpfopen(2025-03-04 05-30-32 的屏幕截图.png,r)FILE* fp1fopen(picture.text,w);if(fpNULL){PRINT_ERROR(error);} if(fp1NULL){PRINT_ERROR(error);}char str[128]{};while((fread(str,sizeof(char),1,fp))!0){if((fwrite(str,sizeof(char),1,fp1))0){return -1;}}fclose(fp);fclose(fp1);return 0;
}