View previous topic :: View next topic |
Author |
Message |
densimitre
Joined: 21 Dec 2004 Posts: 45
|
Printf() Question |
Posted: Sun Apr 17, 2005 11:16 pm |
|
|
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
|
|
Posted: Sun Apr 17, 2005 11:42 pm |
|
|
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
|
|
Posted: Sun Apr 17, 2005 11:52 pm |
|
|
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
|
|
Posted: Sun Apr 17, 2005 11:56 pm |
|
|
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
|
|
Posted: Mon Apr 18, 2005 1:27 am |
|
|
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" |
|
|
|