cancel
Showing results for 
Search instead for 
Did you mean: 

strcat method does not work

chai
Associate II
Posted on August 20, 2012 at 15:14

Hi,

When I use strcat to append a string to a destination string. It does not work. I did it like this.

char *item_list = '''';

strcat(item_list,''hello'');

When I set a break point and check the item_list, it is still NUll.

Any ideas?

24 REPLIES 24
Posted on February 24, 2013 at 15:52

I can only work with the information presented.

If you are using DMA to fill the buffer you need to define it as volatile (ie changed outside the natural flow of the code). You should also look to see if the DMA actually completes.

Add some telemetry via the serial port, and increase it's verboseness until you can understand the flow and structure content.

The issue is outside the code you have presented currently.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 24, 2013 at 16:26

you are right. buffer should be volatile. I changed it, but without good news.

I'm going toattach here my code (_it.c file is empty, and HTML is a string #define).

Yes, I know, I should implement also a FIFO queue. That will be the next step, once solved this issue.

thanks again.

I feel no more alone in this working sunday!

________________

Attachments :

main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyzp&d=%2Fa%2F0X0000000bO8%2F7Fhp2IkOUvocSbblo69PRNSGtkwtoLITLFyMaEJNvDU&asPdf=false
Posted on February 24, 2013 at 22:47

I need to work through the mechanics there, but you definitely need to be clearing the CharBuffer before you start iterating the loop, and ensure the CharBuffer is one byte bigger than the DMA transfer, and the final byte beyond the DMA is NUL.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 25, 2013 at 08:48

ok, thanks.

the buffer will be always filled (by now) with 6 to 1917 chars.

after every ''receive'', it's filled (by memset) with '\0' char.

Posted on February 27, 2013 at 11:40

Solved by RTOS