Traces & pointers to string


Can somone tell me why this doesn’t work:

TRACE (( 1, ">>>SMS_PHONE_NUM: %s", SmsTel));
    TRACE (( 1, ">>>SMS_TEXT: %s", SmsText));

I received wrong data:

Trace	CUS3	1	>>>SMS_PHONE_NUM: 
Trace	CUS3	1	>>>SMS_TEXT: ‹¬$



Check the ADL User Guide carefully - what does it say about the use of %s:question:


OK, found it:



You got it!

If you need formatted output with “variable” strings, you have to sprintf to a buffer first, and then TRACE the buffer…


sprintf( my_trace_buffer, ">>>SMS_PHONE_NUM: %s", SmsTel );
TRACE(( 1,  my_trace_buffer ));


also keep in mind that printing floats has an issue when using GCC


i’m using q2686 wavecom module.
There is some problem at the sprintf ie the device is getting restarted after executing the sprintf line.
the below is the code which i have written .

char * Src_buff;float Temp1=24.3,Temp2=34; int tilt=3,busv=6;
sprintf( Src_buff,“Download from SL100876, Genaral CONSULTANCY , on 07/05/2010 at 16:10:02\n date time , FFA1TS, FFA2TI, FFA3BA, FFA4TA,\ndd/mm/yy hh:mm:ss, 1 ?C, 3 Angle, 5 V,6 K,\n07/06/10 15:30:00, %f, %d, %d, %f,”, Temp1,tilt,busv,Temp2);

but if use it in simple way it wont get restarted ie sprintf( Src_buff,“checking the sprintf”);

what may be the problem , why its getting restarted …?
pls help me…




Did you see the comment above about using %f when using the GCC compiler?

There’s a note in the ADL guide about this too…

ciao, Dave