Linux - Getdate question and calling another program

Discussion in 'C Programming' started by Yann Laviolette, Nov 2, 2003.

  1. 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
     
    Yann Laviolette, Nov 2, 2003
    #1
    1. Advertising

  2. Yann Laviolette

    Jack Klein Guest

    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
     
    Jack Klein, Nov 2, 2003
    #2
    1. Advertising

  3. 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
     
    Tristan Miller, Nov 2, 2003
    #3
  4. 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
     
    Yann Laviolette, Nov 2, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. K S Aldebaraan

    getDate() method and postgres datatype

    K S Aldebaraan, Aug 15, 2003, in forum: Java
    Replies:
    4
    Views:
    13,544
    K S Aldebaraan
    Aug 22, 2003
  2. kris
    Replies:
    1
    Views:
    4,988
    David Fisher
    Dec 10, 2003
  3. Yann Laviolette

    Getdate and gettime

    Yann Laviolette, Nov 2, 2003, in forum: C Programming
    Replies:
    3
    Views:
    472
    Mike Wahler
    Nov 2, 2003
  4. lasek

    getdate...

    lasek, Feb 17, 2005, in forum: C Programming
    Replies:
    1
    Views:
    439
    Lawrence Kirby
    Feb 18, 2005
  5. JACO WESELLS

    GetDate

    JACO WESELLS, Jul 27, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    150
    JACO WESELLS
    Jul 27, 2005
Loading...

Share This Page