problem using the strptime function on HPUXThe strptime function works just

Discussion in 'C Programming' started by kongkolvyu, Jan 4, 2006.

  1. kongkolvyu

    kongkolvyu Guest

    Hi
    The strptime function works just fine on Solaris.
    Here is an example on how I use it:
    struct tm tmpTm;
    if(strptime("20010101010101","%Y%m%d%H%M%S",&tmpTm)==NULL)
    printf("Error,String convert to time Error\n");
    On the HPUX platform, this call to strptime always returns NULL.
    Does anybody have an idea why this does not work.
    kongkolvyu, Jan 4, 2006
    #1
    1. Advertising

  2. kongkolvyu

    tmp123 Guest

    kongkolvyu wrote:
    > Hi
    > The strptime function works just fine on Solaris.
    > Here is an example on how I use it:
    > struct tm tmpTm;
    > if(strptime("20010101010101","%Y%m%d%H%M%S",&tmpTm)==NULL)
    > printf("Error,String convert to time Error\n");
    > On the HPUX platform, this call to strptime always returns NULL.
    > Does anybody have an idea why this does not work.



    Hi,

    I suggest you to add a few spaces between fields, like:

    strptime("2001 01","%Y %m",..

    Kind regards.

    PS: Problem reproduced and proposal verfied in a Tru64 machine.
    tmp123, Jan 4, 2006
    #2
    1. Advertising

  3. kongkolvyu

    Chuck F. Guest

    Re: problem using the strptime function on HPUXThe strptime functionworks just

    kongkolvyu wrote:
    >
    > The strptime function works just fine on Solaris.
    > Here is an example on how I use it:
    > struct tm tmpTm;
    > if(strptime("20010101010101","%Y%m%d%H%M%S",&tmpTm)==NULL)
    > printf("Error,String convert to time Error\n");
    > On the HPUX platform, this call to strptime always returns NULL.
    > Does anybody have an idea why this does not work.
    >

    Because strptime is not a standard C function, and you failed to
    show its source code, we cannot comment on it in any way.

    Whenever you need to specify a platform, you are probably off-topic
    here.

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson
    More details at: <http://cfaj.freeshell.org/google/>
    Chuck F., Jan 4, 2006
    #3
  4. kongkolvyu

    Flash Gordon Guest

    Re: problem using the strptime function on HPUXThe strptime functionworks just

    tmp123 wrote:
    > kongkolvyu wrote:
    >> Hi
    >> The strptime function works just fine on Solaris.
    >> Here is an example on how I use it:
    >> struct tm tmpTm;
    >> if(strptime("20010101010101","%Y%m%d%H%M%S",&tmpTm)==NULL)
    >> printf("Error,String convert to time Error\n");
    >> On the HPUX platform, this call to strptime always returns NULL.
    >> Does anybody have an idea why this does not work.

    >
    > I suggest you to add a few spaces between fields, like:


    <snip>

    It's a POSIX function, not part of standard C, so please redirect
    further discussion of it to somewhere POSIX is topical, such as
    comp.unix.programmer.

    <OT>
    How is strptime to know that you are not talking about some date in the
    year 2AD? Or the year 20010AD? Or the year 20010101010101AD?
    --
    Flash Gordon
    Living in interesting times.
    Although my email address says spam, it is real and I read it.
    Flash Gordon, Jan 4, 2006
    #4
  5. kongkolvyu

    Old Wolf Guest

    kongkolvyu wrote:

    > Hi
    > The strptime function works just fine on Solaris.
    > Here is an example on how I use it:
    > struct tm tmpTm;
    > if(strptime("20010101010101","%Y%m%d%H%M%S",&tmpTm)==NULL)
    > printf("Error,String convert to time Error\n");
    > On the HPUX platform, this call to strptime always returns NULL.
    > Does anybody have an idea why this does not work.


    RTFM. Or if the HPUX man page on strptime does not shed any
    light on the matter, post your question in a HPUX newsgroup or
    some other support channel for HPUX.

    You could also try outputting the desired date with strftime, and
    seeing what it looks like. Usually strptime functions are designed
    to be able to take the output of strftime as an input. YMMV
    Old Wolf, Jan 4, 2006
    #5
    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. PJ
    Replies:
    1
    Views:
    957
    Kathy Burke
    Jun 25, 2003
  2. Gregor Peter

    function just works sometimes

    Gregor Peter, Sep 23, 2003, in forum: C++
    Replies:
    7
    Views:
    358
    Gregor Peter
    Sep 23, 2003
  3. walterbyrd
    Replies:
    1
    Views:
    339
    Damjan
    Apr 10, 2006
  4. Ark Khasin

    Is it just me or just Microsoft?

    Ark Khasin, Jul 15, 2007, in forum: C++
    Replies:
    24
    Views:
    717
    Lionel B
    Jul 16, 2007
  5. Ark Khasin

    Is it just me or just Microsoft?

    Ark Khasin, Jul 15, 2007, in forum: C Programming
    Replies:
    42
    Views:
    1,094
    user923005
    Jul 17, 2007
Loading...

Share This Page