<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Combining strings in CodeWarrior for the MC68HC812 in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155615#M3983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a student doing a microprocessors segment on my degree at Coventry University and we've been given an assignment for the above processor (exact # is MC68HC812A4) - you'll have to bear with me a bit because this is the first time i've done anything along these lines &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're producing a simple program in C++ and as part of it i'd like to do some string operations&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;char item1[3] = "0x0";&lt;/P&gt;&lt;P&gt;char item2[1] = "F";&lt;/P&gt;&lt;P&gt;char result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;strcat(result,item1);&lt;/P&gt;&lt;P&gt;strcat(result,item2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Led_Port=result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attempted to #include &amp;lt;string.h&amp;gt; at the top of the file, but when i go into the true-time debugger and attempt to run this code segment, the debugger halts at the strcat operation and the 'code' window says 'STRING.C NOT FOUND'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help? I'm probably making some kind of schoolboy error - or rather student error!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2009 19:18:41 GMT</pubDate>
    <dc:creator>tomrussell</dc:creator>
    <dc:date>2009-02-24T19:18:41Z</dc:date>
    <item>
      <title>Combining strings in CodeWarrior for the MC68HC812</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155615#M3983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a student doing a microprocessors segment on my degree at Coventry University and we've been given an assignment for the above processor (exact # is MC68HC812A4) - you'll have to bear with me a bit because this is the first time i've done anything along these lines &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're producing a simple program in C++ and as part of it i'd like to do some string operations&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;char item1[3] = "0x0";&lt;/P&gt;&lt;P&gt;char item2[1] = "F";&lt;/P&gt;&lt;P&gt;char result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;strcat(result,item1);&lt;/P&gt;&lt;P&gt;strcat(result,item2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Led_Port=result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attempted to #include &amp;lt;string.h&amp;gt; at the top of the file, but when i go into the true-time debugger and attempt to run this code segment, the debugger halts at the strcat operation and the 'code' window says 'STRING.C NOT FOUND'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help? I'm probably making some kind of schoolboy error - or rather student error!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2009 19:18:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155615#M3983</guid>
      <dc:creator>tomrussell</dc:creator>
      <dc:date>2009-02-24T19:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Combining strings in CodeWarrior for the MC68HC812</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155616#M3984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Sorry - i should also add that this occurs whenever i try and use any 'str' operation - i'm not in the lab at the moment and the c++ code up there is probably far from correct and wouldn't compile &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2009 20:16:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155616#M3984</guid>
      <dc:creator>tomrussell</dc:creator>
      <dc:date>2009-02-24T20:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combining strings in CodeWarrior for the MC68HC812</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155617#M3985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you're not including the appropriate library that would contain the string handling functions. Did you use the New Project wizard to make the project?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by J2MEJediMaster on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-02-24&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;09:35 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2009 22:34:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155617#M3985</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2009-02-24T22:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Combining strings in CodeWarrior for the MC68HC812</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155618#M3986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, i did - created a C++ only project. CodeWarrior shows me having the following files in the filetree:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sources&lt;/P&gt;&lt;P&gt;-main.cpp&lt;/P&gt;&lt;P&gt;-datapage.c (?)&lt;/P&gt;&lt;P&gt;Startup Code&lt;/P&gt;&lt;P&gt;-Start12.cpp&lt;/P&gt;&lt;P&gt;Libraries&lt;/P&gt;&lt;P&gt;-mc68hc812a4.h&lt;/P&gt;&lt;P&gt;-mc68hc812a4.c&lt;/P&gt;&lt;P&gt;-ansisi.lib&lt;/P&gt;&lt;P&gt;-cppsi.lib&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought including the #include &amp;lt;string.h&amp;gt; in the header would import it from another filestore on compile though?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2009 22:57:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155618#M3986</guid>
      <dc:creator>tomrussell</dc:creator>
      <dc:date>2009-02-24T22:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining strings in CodeWarrior for the MC68HC812</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155619#M3987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It appers that the program is much more in C than in C++.&lt;/P&gt;&lt;P&gt;Check the sized of your arrays (result should be an array too, I guess this is a copy paste bug).&lt;/P&gt;&lt;P&gt;The arrays have to be large enough to contain a terminating 0 byte too, item1 and item2 are both too small.&lt;/P&gt;&lt;P&gt;If you do not change a variable, its good practise (and important on a small device) to make the variable const.&lt;/P&gt;&lt;P&gt;And if a variable only contains a const string, its less error prone not to define the size of the array.&lt;/P&gt;&lt;P&gt;E.g. static const char item1[] = "0x0";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also make sure that the destination buffer is setup when you do the first strcat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2009 01:02:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155619#M3987</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2009-02-25T01:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Combining strings in CodeWarrior for the MC68HC812</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155620#M3988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further to Daniel's comments, it would appear that the &lt;FONT face="courier new,courier"&gt;result&lt;/FONT&gt; variable should be defined as either an array or a pointer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2009 07:53:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Combining-strings-in-CodeWarrior-for-the-MC68HC812/m-p/155620#M3988</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-02-25T07:53:20Z</dc:date>
    </item>
  </channel>
</rss>

