Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - convert char to int: (3 Items)
   
convert char to int  
Hi, I have very basic question how can I convert char to int ? a get value from PtText and I want convert char to int. 
I get this way. 

char    *textp;
PtArg_t arg[1];

PtSetArg( &arg[0], Pt_ARG_TEXT_STRING, &textp, 0 );
PtGetResources( ABW_PtText1, 1, arg );

Thanks for any replay. 
RE: convert char to int  
To convert a C character string to a number, look at C library functions
atoi or strtol. 

-----Original Message-----
From: Waldemar KK [mailto:community-noreply@qnx.com] 
Sent: Saturday, June 12, 2010 6:17 PM
To: general-bazaar
Subject: convert char to int

Hi, I have very basic question how can I convert char to int ? a get
value from PtText and I want convert char to int. 
I get this way. 

char    *textp;
PtArg_t arg[1];

PtSetArg( &arg[0], Pt_ARG_TEXT_STRING, &textp, 0 );
PtGetResources( ABW_PtText1, 1, arg );

Thanks for any replay. 



_______________________________________________

General
http://community.qnx.com/sf/go/post56709
Re: RE: convert char to int  
Hi, just do next:

char    *textp;
PtArg_t arg[1];

PtSetArg( &arg[0], Pt_ARG_TEXT_STRING, *(int*)textp, 0 );
PtGetResources( ABW_PtText1, 1, arg );