为什么getdate()函数无法用?请大家帮忙
刚刚开始用c来编程,现在想取系统日期:
#include <dos.h>
#include <stdio.h>
int main(void)
{
struct date d;
getdate(&d);
printf("The current year is: %d\n",d.da_year);
printf("The current day is: %d\n",d.da_day);
printf("The current month is: %d\n",d.da_mon);
return 0;
}
用Microsoft Visual C++ 6.0进行开发。为什么此段程序编译不通过,报
error C2079: 'd' uses undefined struct 'date'
warning C4013: 'getdate' undefined; assuming extern returning int
error C2224: left of '.da_year' must have struct/union type
error C2224: left of '.da_day' must have struct/union type
error C2224: left of '.da_mon' must have struct/union type
难道getdate不在<dos.h>中的吗?
请大家帮忙。谢谢!
问题点数:20、回复次数:1Top
1 楼xbsmail(夏阳)回复于 2005-07-04 18:17:02 得分 20
用VC应该用GetDateTime
Platform SDK: Windows Management Instrumentation
CInstance::GetDateTime
The GetDateTime method returns a datetime property.
bool GetDateTime(
LPCWSTR name,
WBEMTime& wbemtime
);
Parameters
name
Name of the datetime property retrieved.
wbemtime
Buffer to receive the datetime property.
Return Values
Returns TRUE if the operation was successful and FALSE if an attempt was made to retrieve a property that is not a datetime value or a property that does not exist. More information is available in the log file, Framework.log.
Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP4 and later, Windows Me, Windows 98, and Windows 95.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server 4.0 SP4 and later.
Header: Declared in Instance.h; include FwCommon.h.
Library: Use Framedyn.lib.
Platform SDK Release: February 2003 What did you think of this topic?
Order a Platform SDK CD
Top
相关问题
- CreateTimerQueueTimer函数为什么无法编译?
- SQLSERVER的用户定义函数里为什么不能用GETDATE函数???
- 为什么我在自定义函数里使用GETDATE()函数会提示‘在函数里不正确的使用了 'getdate'’的错误?
- 为什么DLL里的API函数无法调用
- 为什么我这里无法调用inet_addr等函数
- 100分!ATL开发activex为什么无法用fopen等函数
- 新手请教:为什么socket函数无法使用?
- 为什么我的TC无法运行图形库函数?
- 我明明定义了窗口的回调函数,为什么说无法转换成(DLGPROC)?难道回调函数不能是成员函数吗?
- 编写一个winsock函数编译后,无法运行为什么




