# adl\_atSendResponse = printf?????

**URL:** <https://forum.sierrawireless.com/t/adl-atsendresponse-printf/3996>\
**Category:** Legacy FX/FXT series\
**Created:** [December 16, 2009, 10:14pm UTC](https://forum.sierrawireless.com/t/adl-atsendresponse-printf/3996 "2009-12-16T22:14:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dany\_Q](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Dany\_Q](https://forum.sierrawireless.com/u/Dany_Q)\
**Post date:** [December 16, 2009, 10:14pm UTC](https://forum.sierrawireless.com/t/adl-atsendresponse-printf/3996/1 "2009-12-16T22:14:57Z")

</div>

Hello there,

I´m developing a program in the M2M Studio and I have a question:  
How can I make the instruction “adl\_atSendResponse” to work like a “printf” in C???

The point is, that I’m interested in making like a “printf(”\nContador=%d", counter)" but with the “adl\_atSendResponse” in order to see the number of the incremental counter in the Shell window.

Any ideas???

I know there is this instruction: “adl\_atSendStdResponseExt” but i don´t know exactly, how it works.

Here´s my code:

```auto
u32 counter;
int counter1;
void MyGpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param )
{
   TRACE (( 1, "EVENT" ));

// Check event
switch ( Event ){

   case ADL_IO_EVENT_INPUT_CHANGED :
	   if (counter1 % 2 == 0)
	   {
	   counter ++;
	   adl_atSendStdResponseExt(ADL_AT_RSP, "\r\nContador", counter);
	   }
	   counter1 ++;
   }
}
```

Thanks

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [December 17, 2009, 1:53am UTC](https://forum.sierrawireless.com/t/adl-atsendresponse-printf/3996/2 "2009-12-17T01:53:23Z")

</div>

Hiya,

The easiest way to do this is to build your output string using wm\_sprintf(), then send the string to the console.

Something like this:

```auto
void myFunction(u8 counter)
{
    ascii *myMsg;

    myMsg = adl_memGet(sizeof(ascii)*128); // allocate memory for string
    myMsg[0] = 0x00; // ensure string starts with 'NUL'

    wm_sprintf(myMsg, "Value of Counter is %d", counter);

    adl_atSendStdResponse(ADL_AT_RSP, myMsg);

    adl_memRelease(myMsg); // free memory
}
```

You could actually wrap the whole process using a function with varargs that would let you emulate the printf() function.

Remember that you can’t use %f in your sprintf string in OpenAT - it will cause an instant ARM exception and reset your module.

ciao, Dave
