蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年6月6日 10:18


[HELP] a error and a worning in a simple c

#include<stdio.h>;
#include<stdlib.h>;
#include<sys/time.h>;
main()
{
        struct tm *abc;
        time_t t2;
        t2=time();
        abc=localtime(&t2);
        printf("%d",abc->;tm_mon);
}
错误信息:
time.c: In function `main':
time.c:9: warning: assignment makes pointer from integer without a cast
time.c:10: error: dereferencing pointer to incomplete type

现在在楼主的帮助下,解决了,正确如下:
#include<stdio.h>;
#include<stdlib.h>;
#include<time.h>;
main()
{
        struct tm *abc;
        time_t t2;
        t2=time(0);
        abc=localtime(&t2);
        printf("%d",abc->;tm_mon);
}
是包含文件是出错了,同时,要修改time()的参数,再次谢谢!

[HELP] a error and a worning in a simple c

malloc

[HELP] a error and a worning in a simple c

time(&t2)

[HELP] a error and a worning in a simple c

有什么错

[HELP] a error and a worning in a simple c

参照下面:
[code]
#include <stdio.h>;
#include <stdlib.h>;
#include <time.h>;

int main(void)
{
        struct tm *abc;
        time_t t2;
        t2=time(0);
        abc=localtime(&t2);
        printf("%d\n",abc->;tm_mon);
        exit(EXIT_SUCCESS);
}[/code]

[HELP] a error and a worning in a simple c

多谢楼主,原来是应该包含/usr/include/time.h,而不是/usr/include/sys/time.h



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com