<?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>Data is lost when passing the array to a function in other file</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91503/data-is-lost-when-passing-the-array-to-a-function-in-other-file</link><description>Hello Everyone 
 I&amp;#39;m working on a project in which some commands are transferred through USB HID. 
 The project is an nRF42840 based one. 
 The data received in nRF42840 is saved in a buffer in a .c file. 
 Sometimes I need to analyze the data in another</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Sep 2022 13:34:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91503/data-is-lost-when-passing-the-array-to-a-function-in-other-file" /><item><title>RE: Data is lost when passing the array to a function in other file</title><link>https://devzone.nordicsemi.com/thread/384604?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 13:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ca337f7-d8bc-4bef-b646-fba260b08114</guid><dc:creator>Kenneth</dc:creator><description>[quote user="Vahidreza"]Is this really the way strlen() function works? zero in the middle will be taken as terminator?[/quote]
&lt;p&gt;Yes. All strings end with 00,&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data is lost when passing the array to a function in other file</title><link>https://devzone.nordicsemi.com/thread/384556?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 11:33:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87cc733a-d45e-42e9-a27b-d9e6873ef9aa</guid><dc:creator>Vahidreza</dc:creator><description>&lt;p&gt;It looks like the problem was that I was passing strlen(BUFFER) as the length of the data to be logged and when there is a 0x00 in the middle of the buffer it takes that zero as terminator and denies the rest of the buffer. &lt;br /&gt;Is this really the way strlen() function works? zero in the middle will be taken as terminator?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data is lost when passing the array to a function in other file</title><link>https://devzone.nordicsemi.com/thread/384090?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2022 10:10:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bf029e2-2558-49a1-a6f5-edd016bccb20</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Does making the buffer static or volatile help? I am thinking the compiler may be optimizing the buffer away if it believes it is not used by the application at some point.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>