📄 subject_26101.htm
字号:
<p>
序号:26101 发表者:流诊圆 发表日期:2002-12-28 21:09:49
<br>主题:如何修改系统时间
<br>内容:不知道在BC或者TC下如何修改系统时间。
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:tjhe 回复日期:2002-12-28 21:56:40
<br>内容:如果是WINDOWS程序BOOL SetSystemTime( CONST SYSTEMTIME *lpSystemTime );<BR><BR>不是,可用函数:<BR>void settime(struct time *timep); //dos.h
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:流诊圆 回复日期:2002-12-28 23:14:25
<br>内容:偶对这个函数不大熟呀!<BR>帮忙帮到底吧。<BR><BR>举个例子让偶看看吧。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:tjhe 回复日期:2002-12-28 23:21:59
<br>内容://tc2.0 dos.h中<BR>struct time {<BR> unsigned char ti_min; /* Minutes */<BR> unsigned char ti_hour; /* Hours */<BR> unsigned char ti_hund; /* Hundredths of seconds */<BR> unsigned char ti_sec; /* Seconds */<BR>};<BR><BR>struct date {<BR> int da_year; /* Year - 1980 */<BR> char da_day; /* Day of the month */<BR> char da_mon; /* Month (1 = Jan) */<BR>};<BR>void _Cdecl setdate (struct date *datep);<BR>void _Cdecl settime (struct time *timep);<BR><BR>#include <stdio.h> <BR>#include <dos.h> <BR><BR>int main(void) <BR>{ <BR> struct time t; <BR><BR> gettime(&t); <BR> printf("The current minute is: %d\n", t.ti_min); <BR> printf("The current hour is: %d\n", t.ti_hour); <BR> printf("The current hundredth of a second is: %d\n", t.ti_hund); <BR> printf("The current second is: %d\n", t.ti_sec); <BR><BR> /* Add one to the minutes struct element and then call settime */ <BR> t.ti_min++; <BR> settime(&t); <BR><BR> return 0; <BR>} <BR><BR>#include <stdio.h> <BR>#include <process.h> <BR>#include <dos.h> <BR><BR>int main(void) <BR>{ <BR> struct date reset; <BR> struct date save_date; <BR><BR> getdate(&save_date); <BR> printf("Original date:\n"); <BR> system("date"); <BR><BR> reset.da_year = 2001; <BR> reset.da_day = 1; <BR> reset.da_mon = 1; <BR> setdate(&reset); <BR><BR> printf("Date after setting:\n"); <BR> system("date"); <BR><BR> setdate(&save_date); <BR> printf("Back to original date:\n"); <BR> system("date"); <BR><BR> return 0; <BR>} <BR><BR><BR><BR>//<BR>typedef struct _SYSTEMTIME { // st <BR> WORD wYear; <BR> WORD wMonth; <BR> WORD wDayOfWeek; <BR> WORD wDay; <BR> WORD wHour; <BR> WORD wMinute; <BR> WORD wSecond; <BR> WORD wMilliseconds; <BR>} SYSTEMTIME; <BR> <BR>SetSystemTime(........)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:流诊圆 回复日期:2002-12-29 15:28:00
<br>内容:very good !<BR>thank you!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -