Re: Re: storing values in typedef struct error.

Scott Henion <[email protected]>
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
On 5/22/2013 12:23 PM, racqueldesign wrote:
> Hi Tom,
>
> Thanks; however I place the below code after each time a string is store:
> device.mc1[8] = (char) NULL;
> which is now:
>
> _f_strncpy(device.mc1,src, 8);
> device.mc1[8] = (char) NULL;  // '\0'
>
> the output is still the same.  I even declare as type far (far mc_t device)and that was even worst, the output is garbage. 

>>device.mc1[8] = (char) NULL;

You are storing a null in the 9th char of an 8-char array that just
happens to be the first char of .mc2

You need to make the arrays larger to hold the null.


-- 
------------------------------------------
     Scott G. Henion, Consultant
Web site:    http://SHDesigns.org
------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.