⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_26101.htm

📁 一些关于vc的问答
💻 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);&nbsp;&nbsp;//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&nbsp;&nbsp;&nbsp;&nbsp;time&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned char&nbsp;&nbsp;&nbsp;&nbsp;ti_min;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Minutes */<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned char&nbsp;&nbsp;&nbsp;&nbsp;ti_hour;&nbsp;&nbsp;&nbsp;&nbsp;/* Hours */<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned char&nbsp;&nbsp;&nbsp;&nbsp;ti_hund;&nbsp;&nbsp;&nbsp;&nbsp;/* Hundredths of seconds */<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned char&nbsp;&nbsp;&nbsp;&nbsp;ti_sec;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Seconds */<BR>};<BR><BR>struct&nbsp;&nbsp;&nbsp;&nbsp;date&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;da_year;&nbsp;&nbsp;&nbsp;&nbsp;/* Year - 1980 */<BR>&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;da_day;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Day of the month */<BR>&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;da_mon;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Month (1 = Jan) */<BR>};<BR>void&nbsp;&nbsp;&nbsp;&nbsp; _Cdecl setdate&nbsp;&nbsp;&nbsp;&nbsp;(struct date *datep);<BR>void&nbsp;&nbsp;&nbsp;&nbsp; _Cdecl settime&nbsp;&nbsp;&nbsp;&nbsp;(struct time *timep);<BR><BR>#include &lt;stdio.h&gt; <BR>#include &lt;dos.h&gt; <BR><BR>int main(void) <BR>{ <BR>&nbsp;&nbsp; struct&nbsp;&nbsp;time t; <BR><BR>&nbsp;&nbsp; gettime(&amp;t); <BR>&nbsp;&nbsp; printf("The current minute is: %d\n", t.ti_min); <BR>&nbsp;&nbsp; printf("The current hour is: %d\n", t.ti_hour); <BR>&nbsp;&nbsp; printf("The current hundredth of a second is: %d\n", t.ti_hund); <BR>&nbsp;&nbsp; printf("The current second is: %d\n", t.ti_sec); <BR><BR>&nbsp;&nbsp; /* Add one to the minutes struct element and then call settime&nbsp;&nbsp;*/ <BR>&nbsp;&nbsp; t.ti_min++; <BR>&nbsp;&nbsp; settime(&amp;t); <BR><BR>&nbsp;&nbsp; return 0; <BR>} <BR><BR>#include &lt;stdio.h&gt; <BR>#include &lt;process.h&gt; <BR>#include &lt;dos.h&gt; <BR><BR>int main(void) <BR>{ <BR>&nbsp;&nbsp; struct date reset; <BR>&nbsp;&nbsp; struct date save_date; <BR><BR>&nbsp;&nbsp; getdate(&amp;save_date); <BR>&nbsp;&nbsp; printf("Original date:\n"); <BR>&nbsp;&nbsp; system("date"); <BR><BR>&nbsp;&nbsp; reset.da_year = 2001; <BR>&nbsp;&nbsp; reset.da_day = 1; <BR>&nbsp;&nbsp; reset.da_mon = 1; <BR>&nbsp;&nbsp; setdate(&amp;reset); <BR><BR>&nbsp;&nbsp; printf("Date after setting:\n"); <BR>&nbsp;&nbsp; system("date"); <BR><BR>&nbsp;&nbsp; setdate(&amp;save_date); <BR>&nbsp;&nbsp; printf("Back to original date:\n"); <BR>&nbsp;&nbsp; system("date"); <BR><BR>&nbsp;&nbsp; return 0; <BR>} <BR><BR><BR><BR>//<BR>typedef struct _SYSTEMTIME {&nbsp;&nbsp;// st <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wYear; <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wMonth; <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wDayOfWeek; <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wDay; <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wHour; <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wMinute; <BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wSecond; <BR>&nbsp;&nbsp;&nbsp;&nbsp;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 + -