By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,960 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,960 IT Pros & Developers. It's quick & easy.

problem using the strptime function on HPUXThe strptime function works just

P: n/a
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.

Jan 4 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

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.

Jan 4 '06 #2

P: n/a
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/>
Jan 4 '06 #3

P: n/a
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.
Jan 4 '06 #4

P: n/a
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

Jan 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.