|
So I would just call time_t? I have an array that I'm trying to store the number in so I can later go back and compare it. In order to accomplish this must I do something like
i is the part of the array I'm using.
array[i] = time_t;
|
|
|
|
|
here is a better example :
#include <ctime>
time_t clock;
time(&clock);
----------------------------------------------------------------
"clock" is a variable of type time_t
time is a function you call to populate the variable "clock"
once you do that, you can do this :
array[i] = clock;
|
|
|
|
|
Both time_t clock and time(&clock) are both included? I'm under the assumption they are part of the header file.
|
|
|
|
|
#include <time.h>
void MyClass::SomeFunction()
{
time_t clock; // this is creating a variable called clock
time(&clock); // calling a function called time
array[i] = clock; // sets the position i of array to the clock value
}
i hope that clears it up a bit for you
|
|
|
|
|
Yes it does. Thank you very much
|
|
|
|
|
wohoo no problem.
Mr Chen was the one that really helped.
|
|
|
|
|
Never Mind. I figured out what I did wrong. Thanx again.
|
|
|
|
|
in CVeh.h at the top of the file,
you should put :
#include <time.h>
does that help at all ? because it looks like it doesn't know where the time function as been defined, and is assuming it is a member function of your CVeh class.
sorry the html here stripped the <time.h> before. give that a go, and see if it helps
|
|
|
|
|
What I did was had a function in there that shouldn't have been there. I forgot to delete it. Here's another question if you don't mind. I set my counter i to 0 in OnInitDialog.
void CVeh::OnButton1()
{
time_t clock;
time(&clock);
cars[i] = clock;
ShowWindow(SW_HIDE);
CAdd dlgCAdd;
dlgCAdd.DoModal();
ShowWindow(SW_SHOW);
i++;
}
void CVeh::OnButton2()
{
m_ed3.Set_Number(cars[i]);
}
The number I'm getting is 1083652994.00. I know for fact that isn't the right number(is it)?
|
|
|
|
|
According to the documentation on MSDN :
The time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC), according to the system clock. The return value is stored in the location given by timer.
therefore, that number is correct. I ran a test and I got 1083653393. So we are around the same ballpark.
|
|
|
|
|
If I want to get the actual time(as in what is is now) then I should divide by what number???
|
|
|
|
|
here is a link to msdn that has same source
MSDN[^]
they use _time64 instead of time, but it pretty much the same thing. I'm not sure what format you want your time in, so i don't know what mean by divide by what number.
eg : ctime( &clock)
will return a string of the the date/time in the variable clock
struct tm *today;
localtime( &clock );
today is a structure that will hold the date/time as numbers.
eg today->tm_hour
today->tm_min
today->tm_sec
|
|
|
|
|
I have a weak understand of this. I don't quite grasp where I use today. Or how I actually get the local time and turn it into numbers. The way we just did it(before this part) gave me just like you said the number of seconds passed since Jan 1 1970.
With this particular way the time is made into a char. I tried just making it an int. The complier gave me an error and wouldn't let me do it.
|
|
|
|
|
Be aware that time() and time_t will fail in 2038. To avoid getting accustomed to these functions, either use _time64() and __time64_t or GetSystemTime() and then convert it to a 64 bit value using SystemTimeToFileTime() .
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thank you for your input I did read that. But for this project I don't really need to worry about that. Does anyone know of a parse that I could do or something similar so I can convert time characters to numbers.
|
|
|
|
|
I am taking std::map which maps CString to CList.
Can somebody help me how to iterate through .
I did a similar example using CMap that maps CString to CString.
Pls guide.
|
|
|
|
|
this is just an example
typedef map <cstring *,clist="" *=""> StrToListMap;
StrToListMap _stlMap;
StrToListMap ::iterator mapIterator;
mapIterator = stlMap.begin();
while(mapIterator != stlMap.end())
{
CString *pString = ((*mapIterator).first);
CList *pList = ((*mapIterator).second);
mapIterator++;
}
hope that helps
|
|
|
|
|
I'm trying to make a program that gets told what size the dialog box needs to be, and the position on screen.
but i found that it is hard coded in .rc files. which isn't good at all for me.
i need to create a dialog box on the fly, have it a certain size, and have buttons that i create.
it all seems to have to be hard coded in and can't be done the way i want. any way around this?
|
|
|
|
|
Xp3ll3d wrote:
have it a certain size
When you want to show your dialog, just before calling DoModal, call MoveWindow (this will move the window but the x and y coordinates are relative to the parent window, so you will probably need to convert it).
Xp3ll3d wrote:
have buttons that i create
In your OnInitDialog function (from your dialog box), you can create dynamically your buttons if you want.
Hope this helps
|
|
|
|
|
it does, thanks alot!!
now i'll go have a look around for those methods
|
|
|
|
|
I am looking for a class(es) that implement a TV guide style infterface. Not quite like a grid, since all the cells in verious lines start and end on arbitrary boundaries. Anybody seen anything like that?
|
|
|
|
|
Is there such a message I can handle?
I have a derived CEdit class and I need to know when a user has set the text programatically...I have tried WM_SETWINDOWTEXT and I get an compile error: undeclared identifier
I have tried capturing WM_SETTEXT also and it doesn't work...
Anyone have ideas...?
How do I print my voice mail?
|
|
|
|
|
I just handled WM_SETTEXT inside WndProc instead of PreTranslateMessage
Everything works fine now
Cheers
How do I print my voice mail?
|
|
|
|
|
Hi people,
Probably an easy question but its really frustating me.
Im trying to add an active X control to a VC project but it just wont let me.
In fact it wont let me add any type of control to a dialog. (Including standard ones)
I try and add an evemt handler and it gives me
Line 327
Char 4
Error Can't move focus to to the control because it is invisible, not enabled or of a type that does not accept the focus.
The annoying things is it works in all other projects . Its just that where I want it to work it wont, but I can't see the difference between the current project and the other projects.
I would really appreciate any help.
(This is in VS.NET)
Thanks.
|
|
|
|
|
This does not sound like a C++ error message.
I had this message text once only when I was using
Visual Basic?
Are you sure you are using VC++?
Or maybe this message comes from the ActiveX itself?
Jens
|
|
|
|