# Send Sms with C++ code

**URL:** <https://forum.sierrawireless.com/t/send-sms-with-c-code/943>\
**Category:** Open AT\
**Created:** [December 18, 2006, 10:03am UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943 "2006-12-18T10:03:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![takis](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@takis](https://forum.sierrawireless.com/u/takis)\
**Post date:** [December 18, 2006, 10:03am UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943/1 "2006-12-18T10:03:40Z")

</div>

Hello everybody,

I want to send an sms using C++ code.

I’m trying the following code but it doesn’t work.

wm\_atSendCommand(45,WM\_AT\_SEND\_RSP\_TO\_EMBEDDED,“AT+CMGS=”+30694000000"\>Good morning"1A"\r");

Is it possible to do this or not?  
Is it another way to achieve it?  
I’d appreciate your help.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [December 18, 2006, 1:24pm UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943/2 "2006-12-18T13:24:22Z")

</div>

> [@takis](#):
>
> I’m trying the following code but it doesn’t work.

What do you mean, “doesn’t work”?

Does it compile?  
What is the return value from wm\_atSendCommand?

Is there any particular reason why you’re using the “Basic” API (wm\_…) rather than the Application Development Layer (adl\_…) ?

> [@](#):
>
> Is it another way to achieve it?

Have you tried looking at the Wavecom samples?  
They include examples of how to send SMS…

---

<div class="post-metadata">

**Author:** ![takis](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@takis](https://forum.sierrawireless.com/u/takis)\
**Post date:** [December 19, 2006, 11:43am UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943/3 "2006-12-19T11:43:26Z")

</div>

Hello,  
I use wm and SND\_CMD and the compilation was ok but no msg was sent.

I found this way easier.  
I use the following code:

ascii TxtStr [100];  
ascii PhoneNumber [30];

wm\_sprintf ( CmdStr, “at+cmgs=%s\r”, PhoneNumber );  
SND\_CMD ( CmdStr );

The Target Monitoring Tools shows me the \> and then i’m sending

wm\_sprintf ( TxtStr, “Hello world\1a” );  
SND\_CMD ( TxtStr );

After that the WM\_AT\_RESPONSE responses me ERROR.

What’s wrong?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [December 19, 2006, 5:10pm UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943/4 "2006-12-19T17:10:19Z")

</div>

You didn’t answer why you’re using the Basic API, rather than ADL?  
Wavecom recommend the Basic API for experts only…

You also didn’t answer whether you’ve looked at the sample applications for sending SMS.

> [@takis](#):
>
> ```auto
> wm_sprintf ( TxtStr, "Hello world\1a" );
> SND_CMD ( TxtStr );
> ```
> 
> After that the WM\_AT\_RESPONSE responses me ERROR.
> 
> What’s wrong?

Surely, that should be:

```auto
wm_sprintf ( TxtStr, "Hello world\x1a" );
SND_CMD ( TxtStr );
```

---

<div class="post-metadata">

**Author:** ![takis](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@takis](https://forum.sierrawireless.com/u/takis)\
**Post date:** [December 20, 2006, 6:51am UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943/5 "2006-12-20T06:51:36Z")

</div>

Hello,  
I use Basic API because I thought it was easier and I have spent a lot of time to change now.  
I looked at the at the samples and i found something.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [December 20, 2006, 7:31am UTC](https://forum.sierrawireless.com/t/send-sms-with-c-code/943/6 "2006-12-20T07:31:47Z")

</div>

> [@takis](#):
>
> I use Basic API because I thought it was easier

Hmm… yes, the name is a bit unfortunate, isn’t it? 😕

“Basic” could easily imply that it’s the “easy” option for making “basic” applications.  
In fact, as far as I can tell, “Basic” means that the facilities provided are only basic - so that the developer has to do a lot more work.

ADL actually makes it a lot “easier” for the application developer.

Maybe this has just lost something in translation from the original French…? (which is not uncommon in the Wavecom documents ☹ )

In this case, though, the Wavecom documents do clearly state that ADL is the one to use unless you really know what you’re doing. 🙂
