problem using the strptime function on HPUXThe strptime function works just

K

kongkolvyu

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.
 
T

tmp123

kongkolvyu said:
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.
 
C

Chuck F.

kongkolvyu said:
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/>
 
F

Flash Gordon

tmp123 said:
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?
 
O

Old Wolf

kongkolvyu said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top