Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Ahg! Time!

Reply
Thread Tools

Ahg! Time!

 
 
HardHackz@gmail.com
Guest
Posts: n/a
 
      03-01-2007
Okay, well, I found out how to get the username:

getenv("username")

Now, I want to get the time. I've tried including time.h and doing:

time() or localtime()

And there is some error in time.h because something has to few
arguments in time.h...some help?

Thanks in advance,
..::HardHackz::.

 
Reply With Quote
 
 
 
 
Arun
Guest
Posts: n/a
 
      03-01-2007
On Mar 1, 12:01 pm, (E-Mail Removed) wrote:
> Okay, well, I found out how to get the username:
>
> getenv("username")
>
> Now, I want to get the time. I've tried including time.h and doing:
>
> time() or localtime()
>


you could try gettimeofday.


> And there is some error in time.h because something has to few
> arguments in time.h...some help?
>


??? what error ???

> Thanks in advance,
> .::HardHackz::.


-A

 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      03-01-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Okay, well, I found out how to get the username:
>
> getenv("username")
>
> Now, I want to get the time. I've tried including time.h and doing:
>
> time() or localtime()
>
> And there is some error in time.h because something has to few
> arguments in time.h...some help?
>


You have an error on line 42 of your code.

In other words, we're not psychic. We don't know what error you've got,
what your code looks like, etc...

Post a minimal, *COMPILABLE* example, along with the errors, and
expected behavior, and then we can help.

See http://www.parashift.com/c++-faq-lit...t.html#faq-5.8




 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      03-01-2007
(E-Mail Removed) wrote:
> Okay, well, I found out how to get the username:
>
> getenv("username")
>
> Now, I want to get the time. I've tried including time.h and doing:
>
> time() or localtime()
>
> And there is some error in time.h because something has to few
> arguments in time.h...some help?


RTFM. 'time' requires one argument - the pointer to a time_t object.
You may pass 0 but you can't just omit it. 'localtime' requires one
argument as well, what do you pass, nothing? RTFM

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
John Harrison
Guest
Posts: n/a
 
      03-01-2007
(E-Mail Removed) wrote:
> Okay, well, I found out how to get the username:
>
> getenv("username")
>
> Now, I want to get the time. I've tried including time.h and doing:
>
> time() or localtime()
>
> And there is some error in time.h because something has to few
> arguments in time.h...some help?
>
> Thanks in advance,
> .::HardHackz::.
>


The time interface is really wierd. Designed in the bad old days when
no-one knew the difference between a good interface and a bad one.

But it's not too complex, you can pick it up pretty quickly, just look
at one of the many references on the internet, or in a book. Do that,
and if you still have questions ask again.

john
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments