Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Linux - Getdate question and calling another program

Reply
Thread Tools

Linux - Getdate question and calling another program

 
 
Yann Laviolette
Guest
Posts: n/a
 
      11-02-2003
Hi!

I look for a function like the Windows function getdate(&d); and
gettime(&t); to have the date and the time. Also I look for a function
like spawnl to call another program. These function should work with
Linux.

Can somebody help me?

Thanks a lot!

Yann
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      11-02-2003
On Sun, 02 Nov 2003 14:24:12 -0500, "Yann Laviolette"
<> wrote in comp.lang.c:

> Hi!
>
> I look for a function like the Windows function getdate(&d); and
> gettime(&t); to have the date and the time. Also I look for a function
> like spawnl to call another program. These function should work with
> Linux.
>
> Can somebody help me?
>
> Thanks a lot!
>
> Yann


Standard C, the topic here, provides the function time() prototyped in
<time.h> for getting the current system date and time. It also
provides the standard library function system() prototyped in
<stdlib.h> which may be able to launch external programs. Look them
up in your compiler's library documentation, man pages, or help files.

None of the functions you mentioned are part of standard C, so they
are all off-topic here. If you want Linux specific answers, ask in a
Linux programming group such as news:comp.os.linux.development.apps.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
Reply With Quote
 
 
 
 
Tristan Miller
Guest
Posts: n/a
 
      11-02-2003
Greetings.

In article <>, Yann Laviolette
wrote:
> I look for a function like the Windows function getdate(&d); and
> gettime(&t); to have the date and the time.


Without more information on what exactly getdate() and gettime() are
supposed to do, I can only recommend the following:

#include <time.h>

time_t time(time_t *t);

(IIRC, even this isn't guaranteed to work, as C doesn't require that the
system have a clock.)

> Also I look for a function
> like spawnl to call another program.


"Call" in what way? The standard way is to use the system() function
defined in <stdlib.h>, though you may be looking for a POSIX-style fork()
exec(). The latter isn't standard C, but is widely supported on most Un*x
compilers, including those for Linux.

> These function should work with Linux.


The above will work on Linux, or for that matter on any other system with a
conformant C compiler.

If you want something more specific to Linux, you'll have to ask in a
newsgroup catering to that platform. Try a gcc newsgroup.

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
 
Reply With Quote
 
Yann Laviolette
Guest
Posts: n/a
 
      11-02-2003
Le Sun, 02 Nov 2003 21:27:54 +0000, Jack Klein a écrit*:

Thanks a lot Jack! You help me a lot! My problem is now solve.

Byebye!

Yann
 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetDate JACO WESELLS ASP .Net Web Controls 0 07-27-2005 08:38 PM
getdate... lasek C Programming 1 02-18-2005 10:53 AM
using getdate() how can i get todays date in mm/dd/yy format? any sug please kris C++ 1 12-10-2003 01:40 AM
Getdate and gettime Yann Laviolette C Programming 3 11-02-2003 10:44 PM
getDate() method and postgres datatype K S Aldebaraan Java 4 08-22-2003 03:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57