1753833 Members
8168 Online
108806 Solutions
New Discussion юеВ

strtok_r 64 BIT HP unix

 
Srinivasan S_1
Advisor

strtok_r 64 BIT HP unix

Is strtok_r is supported in 64 BIT HP unix ?
When compiled in 64 Bit it gives warning.
and on usage it gives core dump.

Have any one faced similar problem ,thought confirm.
12 REPLIES 12
Karthik S S
Honored Contributor

Re: strtok_r 64 BIT HP unix

Did you try this depot file?? Not sure if it will be helpful,

http://hpux.connect.org.uk/hppd/hpux/Development/Tools/TS-1.08/

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Mark Grant
Honored Contributor

Re: strtok_r 64 BIT HP unix

Well, I've just been playing with it and strtok() is fine but I get a bus error using strtok_r.

Weird! I'll keep playing with that!
Never preceed any demonstration with anything more predictive than "watch this"
Mark Grant
Honored Contributor

Re: strtok_r 64 BIT HP unix

Actually, I'm seem to be going a bit daft. Forgot that strtok_r needs to be passed the address of the character string pointer, not the character string pointer itself. It seems to be ok now.

Maybe you are doing the same thing?
Never preceed any demonstration with anything more predictive than "watch this"
Srinivasan S_1
Advisor

Re: strtok_r 64 BIT HP unix

Eg: t1.c
#include
#include
#include
void main(){
char usr[36];
char *name[5];
char *arr=NULL;
memset(usr,'\0',sizeof(usr));
strcpy(usr,"ab cd ef");
name[0]=(char *)strtok_r(usr," ",&arr);
printf("arr is %s\n",arr);
printf("name is %s\n",name[0]);
return ;
}
[node:/tmp]
Compilation Trace:
cc +DD64 -g -o t1 t1.c
cc: 487: warning : Possibly incorrect message catalog.
cc: "t1.c", 10: 724: , line : warning Cast: converts default int return type to pointer.

The same Code goes without warning in 32 bit compilation mode but aborts in 64 bit.
I am unable to track why this warning is produced in 64 BIT compilation

Thanks.

Mark Grant
Honored Contributor

Re: strtok_r 64 BIT HP unix

Ok, I have just compiled and run your code fine on 11.0 64 bit and 11i 64 bit.

What compiler are you using? I'm just using the default compiler that comes with a standard HPUX install. I just compiled it fine using gcc though that was on Linux.
Never preceed any demonstration with anything more predictive than "watch this"
Srinivasan S_1
Advisor

Re: strtok_r 64 BIT HP unix

cpp.ansi: HP92453-01 B.11.11.06 HP C Preprocessor (ANSI)
ccom: HP92453-01 B.11.11.28212.GP HP C Compiler
Srinivasan S_1
Advisor

Re: strtok_r 64 BIT HP unix

The compiler used for strtok_r problem is

cpp.ansi: HP92453-01 B.11.11.06 HP C Preprocessor (ANSI)
ccom: HP92453-01 B.11.11.28212.GP HP C Compiler

Mark Grant
Honored Contributor

Re: strtok_r 64 BIT HP unix

I can't see any patches for this either.

If you are running this on a 64 bit machine, try compiling it with no options i.e just "-o"
Never preceed any demonstration with anything more predictive than "watch this"
Adam J Markiewicz
Trusted Contributor

Re: strtok_r 64 BIT HP unix

Hi

>>
cc: "t1.c", 10: 724: , line : warning Cast: converts default int return type to pointer.
<<

Undoubtly you use the function that is not previously declared to the compiler. It should work even without casting.

try:

cc +DD64 -g -o t1 -D_REENTRANT t1.c


Good luck
Adam
I do everything perfectly, except from my mistakes