| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1869 人关注过本帖
标题:请问在C语言中怎么才能取系统时间写到文本里
只看楼主 加入收藏
a82101860
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-4-16
收藏
 问题点数:0 回复次数:3 
请问在C语言中怎么才能取系统时间写到文本里

呵呵。。只是它不常用罷了。
下面就是一個例子。你看一下吧!
#include <stdio.h>
#include <dos.h>
int main(void)
{
struct time t;
gettime(&t);
printf("The current time is: %2d:%02d:%02d.%02d
",t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);
return 0;
}

#include <stdio.h>
#include <dos.h>
int main()
{
union REGS regs;

regs.h.ah=0x2a;
int86(0x21, &regs, &regs);

printf("%d年 %d月 %d日 星期 %d",regs.x.cx,regs.h.dh,regs.h.dl,regs.h.al);
}


===================
我用不了 我家的都是VC++6.0
问下 VC6.0中
用C语言取系统时间的方法 我知道 system("data \t"); 显示时间 但我取不了
我取系统时间写的文本了 要能在VC++6.0能用 谢谢 写具体的 我是新手



搜索更多相关主题的帖子: C语言 文本 系统 时间 
2006-04-16 15:53
wpan66
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-2-2
收藏
得分:0 

#include <stdio.h>
#include <time.h>
unsigned char sCurDate[30];
void SendCentreTime(void)
{
struct tm *current_date;
time_t seconds;

time(&seconds);
current_date = localtime(&seconds);

memset(sCurDate, 0 , 100);
sprintf(sCurDate, "%04d-%02d-%02d %02d:%02d:%02d",current_date->tm_year+1900,
current_date->tm_mon+1, current_date->tm_mday,
current_date->tm_hour, current_date->tm_min,current_date->tm_sec);

}
void main()
{
SendCentreTime();
printf("Current time is:%s\n", sCurDate);
}


2006-04-24 23:56
asasmy
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-6-24
收藏
得分:0 
请问用tc如何编病毒  要求以时间为触发条件    只要文件在机子上  时间一到就执行  ~

我来学习的
2006-06-24 21:09
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 
以下是引用asasmy在2006-6-24 21:09:13的发言:
请问用tc如何编病毒 要求以时间为触发条件 只要文件在机子上 时间一到就执行 ~

咦..以前好象还真看过..俺给你找找


[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-06-24 21:16
快速回复:请问在C语言中怎么才能取系统时间写到文本里
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018463 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved