当前位置: 代码迷 >> C语言 >> [求助]为什么不能通过呢?
  详细解决方案

[求助]为什么不能通过呢?

热度:104   发布时间:2007-10-04 10:40:15.0
[求助]为什么不能通过呢?
#include<time.h>
main()
{
struct tm *ptr;
time_t lt;
char str[80];
lt=time(0);
ptr=localtime(&lt);
strftime(str,70,"the now time is:%F %T",ptr);
printf(str);
system("pause");
}
TC里提示:"_strftime"没有定义.怎么回事?
搜索更多相关的解决方案: system  include  

----------------解决方案--------------------------------------------------------
有这个函数吗?我怎么没查到?
----------------解决方案--------------------------------------------------------
时间函数啊?近段被时间函数搞的不行了.今天总算搞懂了不少.
----------------解决方案--------------------------------------------------------
差一个头文件#include&lt;iostream&gt;
----------------解决方案--------------------------------------------------------
以下是引用gospark在2007-10-4 11:03:44的发言:
差一个头文件#include<iostream>

TC里


----------------解决方案--------------------------------------------------------
函数名: localtime
功 能: 把日期和时间转变为结构
用 法: struct tm *localtime(long *clock);
程序例:
#include
#include
#include
int main(void)
{
time_t timer;
struct tm *tblock;
/* gets time of day */
timer = time(NULL);
/* converts date/time to a structure */
tblock = localtime(&timer);
printf("Local time is: %s", asctime(tblock));
return 0;
}

----------------解决方案--------------------------------------------------------
斑竹没有回答我的问题啊?
----------------解决方案--------------------------------------------------------

TC里不支持这个文件.
我刚才查了一下,在win_tc的include文件的time.h中找不到strftime的定义.


----------------解决方案--------------------------------------------------------
以下是引用nuciewth在2007-10-4 22:03:19的发言:

TC里不支持这个文件.
我刚才查了一下,在win_tc的include文件的time.h中找不到strftime的定义.

我也没找到!
----------------解决方案--------------------------------------------------------
应该是不支持
我C-FREE里可以运行.
----------------解决方案--------------------------------------------------------