📄 util.ec
字号:
#include <stdio.h>
$include datetime;
char *transDate(char *Date)
{
char *str;
str=(char*)malloc(20);
*str=*(Date+6);
*(str+1)=*(Date+7);
*(str+2)=*(Date+8);
*(str+3)=*(Date+9);
*(str+4)='\0';
strcat(str,"年");
*(str+6)=*Date;
*(str+7)=*(Date+1);
*(str+8)='\0';
strcat(str,"月");
*(str+10)=*(Date+3);
*(str+11)=*(Date+4);
*(str+12)='\0';
strcat(str,"日");
return str;
}
char *currentYear()
{
char out_str[16],*year;
$datetime year to hour dt1;
year = (char*)malloc(9);
/* Get today's date */
dtcurrent(&dt1);
/* Convert to ASCII for displaying */
dttoasc(&dt1, out_str);
*year=*out_str;
*(year+1)=*(out_str+1);
*(year+2)=*(out_str+2);
*(year+3)=*(out_str+3);
*(year+4)='\0';
return year;
}
char *currentMonth()
{
char out_str[16],*month;
$datetime year to hour dt1;
month = (char*)malloc(9);
/* Get today's date */
dtcurrent(&dt1);
/* Convert to ASCII for displaying */
dttoasc(&dt1, out_str);
*month=*(out_str+5);
*(month+1)=*(out_str+6);
*(month+2)='\0';
return month;
}
char *QueryStartYear()
{
return currentYear();
}
char *QueryStartMonth()
{
return currentMonth();
}
FetchHTMLFile(char *filename,char *user_id)
{
char ch;
FILE *fp;
if((fp=fopen(filename,"r"))!=NULL){
for(;;){
ch = fgetc(fp);
if (ch == EOF)
break;
else if (ch == '*')
printf(user_id);
else if (ch == '#')
printf("%s",QueryStartYear());
else if (ch == '$')
printf("%s",QueryStartMonth());
else
putchar(ch);
}
fclose(fp);
}
}
char *YMDtransDate(char *Date)
{
char *str;
str=(char*)malloc(20);
*str=*(Date+6);
*(str+1)=*(Date+7);
*(str+2)=*(Date+8);
*(str+3)=*(Date+9);
*(str+4)='\0';
strcat(str,"年");
*(str+6)=*Date;
*(str+7)=*(Date+1);
*(str+8)='\0';
strcat(str,"月");
*(str+10)=*(Date+3);
*(str+11)=*(Date+4);
*(str+12)='\0';
strcat(str,"日");
return str;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -