CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

atoi How about itoa

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

atoi How about itoa
PostPosted: Fri Jun 25, 2004 8:01 am     Reply with quote

Hi:
I knew that CCS have a built in function as atoi, is that also possible to use itoa function?


Thank you
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 8:23 am     Reply with quote

I compiled the file just using char a=itoc(8), I already include <stdlib.h,> error as undefined identifier itoc, so I believe itoc is not support in CCS. any other opinions.
valemike
Guest







PostPosted: Fri Jun 25, 2004 8:24 am     Reply with quote

There doesn't seem to be an itoa() function in the documentation, so you'll have to make your own.

I think the K&R book has an example you can copy.
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

View user's profile Send private message Send e-mail

PostPosted: Fri Jun 25, 2004 8:30 am     Reply with quote

Look at sprintf()
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 9:25 am     Reply with quote

Thanks
when I complied this following program, an error, an expression must evalust to constant occcured, how to correct it.

char PinNum[7];
int i;
for(i=0;i<7;i++)
{
sprintf(PinNum,"PIN_B%u",i);
output_high(PinNum);
delay_ms(20);
output_low(PinNum);
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

View user's profile Send private message Send e-mail

PostPosted: Fri Jun 25, 2004 10:04 am     Reply with quote

young wrote:
Thanks
when I complied this following program, an error, an expression must evalust to constant occcured, how to correct it.

char PinNum[7];
int i;
for(i=0;i<7;i++)
{
sprintf(PinNum,"PIN_B%u",i);
output_high(PinNum);
delay_ms(20);
output_low(PinNum);


Unfortunately output_high() and output_low() requires a constant integer.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 1:14 pm     Reply with quote

Quote:
when I complied this following program, an error, an expression
must evaluate to constant occcured, how to correct it.
output_high(PinNum);

Look at the following thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=18233
Mark has posted two functions for output_high and
output_low that let you pass a CCS-style pin number
to the functions as a variable, instead of a constant.
Look for these function names in his post:
my_output_high()
my_output_low()
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group