|
-
Jun 12th, 2001, 12:47 AM
#1
Thread Starter
Frenzied Member
getting the time
I don't understand why this won't work.
Code:
SYSTEMTIME stime;
GetLocalTime(stime);
--------------------Configuration: Dialog - Win32 Debug--------------------
Compiling...
Dialog.cpp
C:\C++\Dialog\Dialog.cpp(15) : error C2501: 'GetLocalTime' : missing storage-class or type specifiers
C:\C++\Dialog\Dialog.cpp(15) : error C2373: 'GetLocalTime' : redefinition; different type modifiers
c:\program files\microsoft visual studio\vc98\include\winbase.h(2844) : see declaration of 'GetLocalTime'
C:\C++\Dialog\Dialog.cpp(15) : error C2440: 'initializing' : cannot convert from 'struct _SYSTEMTIME' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
Dialog.exe - 3 error(s), 0 warning(s)
-
Jun 12th, 2001, 04:26 AM
#2
Frenzied Member
I don't know the rest of your code but:
1. Include the windows.h file
2. GetLocalTime requires the address of the SYSTEMTIME structure
so use
Code:
SYSTEMTIME stime;
GetLocalTime(&stime);
-
Jun 12th, 2001, 09:11 AM
#3
Thread Starter
Frenzied Member
OK, It's fixed.
How can I get stime.wHour & stime.wMinute & stime.wSecond
into a string to print to a text box or message box?
Last edited by wey97; Jun 12th, 2001 at 09:26 AM.
-
Jun 12th, 2001, 12:33 PM
#4
Monday Morning Lunatic
Use sprintf (actually snprintf is better if you have it).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|