#pragma code("kernel32.dll")
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
#pragma code()
SYSTEMTIME sysTime;
char x[20]="";
GetLocalTime(&sysTime);
sprintf(x,"%04d%02d%02d%02d%02d%02d",sysTime.wYear,sysTime.wMon,sysTime.wDay,sysTime.wHour,sysTime.wMin,sysTime.wSec);
return x;
}
编译不通过,提示:sprintf(x,"%04d%02d%02d%02d%02d%02d",sysTime.wYear,sysTime.wMon,sysTime.wDay,sysTime.wHour,sysTime.wMin,sysTime.wSec);
该段 unknown struct/union menber
请问该段这样写有问题吗?
最佳答案
sysTime.wMon应该改为sysTime.wMonth
sysTime.wMin应该改为sysTime.wMinute,
sysTime.wSec应该改为sysTime.wSecond
提问者对于答案的评价:
谢谢版主
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc275982.html