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

Printf problems

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







Printf problems
PostPosted: Mon May 12, 2003 4:07 pm     Reply with quote

I'm having trouble with printf statements. More specifically, I have a menu I want to display with options over a serial port to be picked up by hyperterminal. However, when I run the code I don't get a nice left justified menu, but more of a waterfall effect. It seems my \n isn't a true line feed. What is going on? This seems like there should be a simple fix, but I'm at a loss.

Here's the code:

do
{


printf("Welcome to the TB2 Flash Configurator\n");
printf("Please pick from the following options:\n");
printf("(1) Read flashID\n");
printf("(2) Write flashID\n");
printf("(3) Read Rindex\n");
printf("(4) Write Rindex\n");
printf("(5) Print array contents\n");
printf("(6) Write array contents\n");
printf("(7) Print memory contents\n");
printf("Choice: ");
choice=getc();


Any clues?

Jon-Paul
___________________________
This message was ported from CCS's old forum
Original Post ID: 14387
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Printf problems
PostPosted: Mon May 12, 2003 4:15 pm     Reply with quote

:=I'm having trouble with printf statements. More specifically, I have a menu I want to display with options over a serial port to be picked up by hyperterminal. However, when I run the code I don't get a nice left justified menu, but more of a waterfall effect. It seems my \n isn't a true line feed. What is going on? This seems like there should be a simple fix, but I'm at a loss.
-------------------------------------------------------------

It's a line feed only. That's the problem. With CCS,
you need to use "\r" to get the carriage return.
Example:

printf("Hello World\n\r");

You should review the example files to see how CCS does things.
The files are in this folder: C:\Program Files\Picc\Examples
___________________________
This message was ported from CCS's old forum
Original Post ID: 14388
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