Inout:更新数据检查方式
This commit is contained in:
parent
4321e5a9d1
commit
2287744230
|
@ -54,6 +54,12 @@ date read_date() {
|
|||
date ret;
|
||||
swscanf(date_str, L"%4d-%2d-%2d-%2d:%2d",
|
||||
&(ret.year), &(ret.month), &(ret.day), &(ret.hour), &(ret.minute));
|
||||
if (ret.month < 0 || ret.month > 12 || ret.day < 0 || ret.day > 31 || ret.hour < 0 || ret.hour > 24 || ret.minute < 0 || ret.minute > 60) {
|
||||
set_console_text_color(RED);
|
||||
wprintf(L"日期错误,请重新输入\n");
|
||||
restore_prev_color();
|
||||
goto start;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue