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

Printf() Question

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



Joined: 21 Dec 2004
Posts: 45

View user's profile Send private message

Printf() Question
PostPosted: Sun Apr 17, 2005 11:16 pm     Reply with quote

Hi. Sorry for my bad english...

In this code:

Code:
printf("AT+CMGS=\"+447919916721\"");


Why is presents the "\" character after "=" and after "1" ??


Can you explain me how printf() its work to send AT command to cell phone?

Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 17, 2005 11:42 pm     Reply with quote

The double-quote symbol is used to enclose the format specification
string in a printf statement. But what if you want to print a double-quote
symbol ? You can't type it into the format specification. If you do,
the compiler will give an error message. So, the answer is to use an
escape sequence. This consists of the backslash symbol, followed
by the double-quote symbol.
This MSDN article gives a list of Escape sequences.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_clang_escape_sequences.asp

Example:

This statement will give the error message: Expecting a close paren
printf(""");

This statement will compile OK. It will print one double-quote symbol: "
printf("\"");
densimitre



Joined: 21 Dec 2004
Posts: 45

View user's profile Send private message

PostPosted: Sun Apr 17, 2005 11:52 pm     Reply with quote

WOW MAster, thank you very much

I hpe learn to receive data from cell phone after send a command to cell phone in AT format....Do You know a simple way for receive that data and store it in a string, to after compare both with a string stored in PIC......how receive a string with no matter long about it.

Thank you very much
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 17, 2005 11:56 pm     Reply with quote

I haven't done a cell phone project, but other people on here have,
and they will give you an answer. You should post the manufacturer
and model number of the cell phone that you are using for your project.
Guest








PostPosted: Mon Apr 18, 2005 1:27 am     Reply with quote

To send an SMS:
AT+CMGS="+41......." // phone number in intl format
>hello<CTRL+Z>

To retrieve any incoming SMS(s):
AT+CMGL="REC UNREAD"
Or to retrieve all incl. already read:
AT+CMGL="ALL"
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