By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,864 Members | 1,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,864 IT Pros & Developers. It's quick & easy.

problems with siemens m20 gsm modem & c++

P: n/a
Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.
Jul 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Janne wrote:
Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.


How is this a C++ problem? Talk to a Siemens tech-support group.

Jacques.

Jul 22 '05 #2

P: n/a
Janne wrote:

Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.


Generally you should ask this the guys who designed the m20.
But I would try \n

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #3

P: n/a
On Fri, 09 Jan 2004 02:50:53 -0800, Janne wrote:
Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.


Maybe you can check the specs of the modem? You'll not get many answers in
this group, this group deals with the C++ language, not with modems.

That said, you do realize that '\r' is a seldomly used code by itself? EOL
conventions differ, but the most common are "\n" and "\n\r". '\r' may be
the code generated by the return key on some terminals, but that is about
as far as it goes, that has /nothing/ to do with how you should end you
lines, both in C++ and with modems.

<OT> IIRC hayes compatible modems (almost all of them are) use "\r\n" to
end lines. </OT>

HTH,
M4

Jul 22 '05 #4

P: n/a
On 9 Jan 2004 02:50:53 -0800 in comp.lang.c++, ja*****@jippii.fi (Janne)
was alleged to have written:
at = "ATI"+"\r";


Is this supposed to mean that you are adding two (char *) pointers?

Jul 22 '05 #5

P: n/a
On 9 Jan 2004 02:50:53 -0800, ja*****@jippii.fi (Janne) wrote in
comp.lang.c++:
Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL); ^^^^^^^^^^^^^
Why are you writing one more character than the length of the C
string? Do you think the modem really wants the '\0'? Probably not.
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.


--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.