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 CCS Technical Support

fprint quotes question

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



Joined: 17 Dec 2005
Posts: 58

View user's profile Send private message

fprint quotes question
PostPosted: Fri Aug 22, 2008 11:27 am     Reply with quote

I want to send out a string over the serial port enclosed in quotes.

Using printf(""test""); wont work as the compiler complains about the double quotes.

Any ideas?

thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 22, 2008 11:32 am     Reply with quote

This is really a Google question. Look at printf escape sequences.
http://web.mit.edu/10.001/Web/Course_Notes/c_Notes/tips_printf.html
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

PostPosted: Fri Aug 22, 2008 6:00 pm     Reply with quote

Try puts(""test"");
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 22, 2008 6:11 pm     Reply with quote

That won't work. puts() is defined in this CCS file:
Quote:
c:\program files\picc\drivers\stdio.h

It's defined as using printf, which he has already found to not compile.
Code:
#define puts(s) {printf(s); putchar(13); putchar(10);}

The solution is in the link I posted.
RayJones



Joined: 20 Aug 2008
Posts: 30
Location: Melbourne, Australia

View user's profile Send private message Visit poster's website

PostPosted: Fri Aug 22, 2008 11:35 pm     Reply with quote

Try

"\"string to Print with quotes\""

Ray
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