<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>STRCAT not working when sending data from nrf52840 and no response in the apps.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54325/strcat-not-working-when-sending-data-from-nrf52840-and-no-response-in-the-apps</link><description>Why when I want to concatenate this string with other string it fails to send the combined string ?? So how do concatenate the string ??</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Nov 2019 10:42:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54325/strcat-not-working-when-sending-data-from-nrf52840-and-no-response-in-the-apps" /><item><title>RE: STRCAT not working when sending data from nrf52840 and no response in the apps.</title><link>https://devzone.nordicsemi.com/thread/221029?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2019 10:42:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:747b879b-c271-4956-8be5-ceb507fdf67f</guid><dc:creator>ox00</dc:creator><description>&lt;p&gt;snprintf(buf,42, &amp;quot;A%dBBCCDDEEAABBCCDDEEAABBCCDDEEAABBCCDDXX&amp;quot;, i); &lt;br /&gt; // puts string into buffer&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;use this function to concatenate the string.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STRCAT not working when sending data from nrf52840 and no response in the apps.</title><link>https://devzone.nordicsemi.com/thread/219960?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2019 02:50:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3aced313-566c-4ebd-81ee-6781a34aeeec</guid><dc:creator>ox00</dc:creator><description>&lt;p&gt;You are so helpful Simon. Thanks bro!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STRCAT not working when sending data from nrf52840 and no response in the apps.</title><link>https://devzone.nordicsemi.com/thread/219950?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 23:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:786b1b55-6197-4ce5-98df-91809b318f58</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;This is because&amp;nbsp;a[] is not large enough to contain the concatenated resulting string, see &lt;a href="https://www.tutorialspoint.com/c_standard_library/c_function_strcat.htm"&gt;the documentation&lt;/a&gt;. It should be large enough to store the initial string in addition to the string to be appended.&lt;/p&gt;
&lt;p&gt;I tried to experiment and figured out that the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t a[]=&amp;quot;A1BBCCDDEEAABBCCDDEEAABBCCDDEEAABBCCDDEE&amp;quot;;
uint8_t test[]=&amp;quot;XXX123&amp;quot;;
strcat(a, test);
NRF_LOG_INFO(&amp;quot;a[]: %s&amp;quot;,a);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Gave the following output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;lt;info&amp;gt; app: a[]: A1BBCCDDEEAABBCCDDEEAABBCCDDEEAABBCCDDEEXXX123&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is because the strcat operation will write outside a[]. However, you should not rely on this and you should set the size of a[] when you define it. Read why on &lt;a href="https://stackoverflow.com/questions/20922478/size-definition-of-strcat-function"&gt;this thread&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>