Re: Re: storing values in typedef struct error.
jima <jima-3OvB8YfVQ3W/[email protected]>
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
Zero index reference strikes again. Welcome to my world! :-) Jim Ashby President, CEO IDE Solutions, LLC 1028 S 770 E Saint George, UT 84790 Office: (435) 767-0957 Cell (435) 619-5333 On 5/22/2013 10:43 AM, Scott Henion wrote: 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 ------------------------------------------ __._,_.___ Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5) Recent Activity: - New Members 2 Visit Your Group http://groups.yahoo.com/;_ylc=X3oDMTJkMDlzbmFxBF9TAzk3NDc2NTkwBGdycElkAzIzMDczMTYEZ3Jwc3BJZAMxNzA2NTU0MjA1BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMzY5MjQxODQy Switch to: Text-Only , Daily Digest • Unsubscribe • Terms of Use • Send us Feedback . __,_._,___