目的;
在一个对话框中设定好开机时间stro ,后将年月日..显示在上级对话框中,同时转为int 型与系统时间比较问题: 经过下面的转换之后,数据出错,
CString stro,strc,year,month,day,hour,minute,second;
CString yearc,dayc,monthc,hourc,minutec,secondc;
int i;
char tempyo[4];
char tempmo[2];
char tempdo[2];
char tempho[2];
char tempmino[2];
char tempso[2];
for(i=0;i<year.GetLength();i++) //year,month,day.....是前面设定好的开机时间
tempyo[i]=year.GetAt(i); //
nYearo=atoi(tempyo); //转换成为int型
/////////////////////////////////////////////////以下类似
for(i=0;i<month.GetLength();i++)
tempmo[i]=month.GetAt(i);
nMontho=atoi(tempmo); for(i=0;i<day.GetLength();i++)
tempdo[i]=day.GetAt(i);
nDayo=atoi(tempdo);
for(i=0;i<hour.GetLength();i++)
tempho[i]=hour.GetAt(i);
nHouro=atoi(tempho); for(i=0;i<minute.GetLength();i++)
tempmino[i]=minute.GetAt(i);
nMinuteo=atoi(tempmino); for(i=0;i<second.GetLength();i++)
tempso[i]=second.GetAt(i);
nSecondo=atoi(tempso); UpdateData(FALSE);
在一个对话框中设定好开机时间stro ,后将年月日..显示在上级对话框中,同时转为int 型与系统时间比较问题: 经过下面的转换之后,数据出错,
CString stro,strc,year,month,day,hour,minute,second;
CString yearc,dayc,monthc,hourc,minutec,secondc;
int i;
char tempyo[4];
char tempmo[2];
char tempdo[2];
char tempho[2];
char tempmino[2];
char tempso[2];
for(i=0;i<year.GetLength();i++) //year,month,day.....是前面设定好的开机时间
tempyo[i]=year.GetAt(i); //
nYearo=atoi(tempyo); //转换成为int型
/////////////////////////////////////////////////以下类似
for(i=0;i<month.GetLength();i++)
tempmo[i]=month.GetAt(i);
nMontho=atoi(tempmo); for(i=0;i<day.GetLength();i++)
tempdo[i]=day.GetAt(i);
nDayo=atoi(tempdo);
for(i=0;i<hour.GetLength();i++)
tempho[i]=hour.GetAt(i);
nHouro=atoi(tempho); for(i=0;i<minute.GetLength();i++)
tempmino[i]=minute.GetAt(i);
nMinuteo=atoi(tempmino); for(i=0;i<second.GetLength();i++)
tempso[i]=second.GetAt(i);
nSecondo=atoi(tempso); UpdateData(FALSE);
nYearo=atoi(year);
nMontho=atoi(month);
...