<?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>CodeWarrior for MCU中的主题 Re: sscanf function fails CW 5.9 IDE</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191653#M6889</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using sscanf() on a 8- or 16-bit microcontroller? I can't come up with any reason why one would do that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Mar 2011 14:51:44 GMT</pubDate>
    <dc:creator>Lundin</dc:creator>
    <dc:date>2011-03-22T14:51:44Z</dc:date>
    <item>
      <title>sscanf function fails CW 5.9 IDE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191650#M6886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The function&amp;nbsp;&amp;nbsp;vsscanf(LIBDEF_ConstStringPtr ps, LIBDEF_ConstStringPtr format, va_list args) in the scanf.c library always fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt;int x;&lt;/P&gt;&lt;P&gt;int result;&lt;/P&gt;&lt;P&gt;result=sscanf("123","%d",&amp;amp;x);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;result always returns 0 and x never has the value 123.&lt;/P&gt;&lt;P&gt;This is because:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (*s++ == *format++) { /*lint !e931 the expression is safe */&lt;/P&gt;&lt;P&gt;in the function vsscanf line can never be true. The code then jumps to inputFailure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why would the input string be compared against the format string? It doesn't seem to make any sense.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 02:29:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191650#M6886</guid>
      <dc:creator>jmborchers</dc:creator>
      <dc:date>2011-03-17T02:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: sscanf function fails CW 5.9 IDE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191651#M6887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First please always mention what CPU/derivative you are targeting, this board is for so different chips like a RS08 (does not have a stack) up to a Coldfire V1 (32 bit registers).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing that there must be something wrong with your setup, for example not enought stack space, using the a library which is incompatible with the provided options, issues with the memory layout, ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The line you are quoting is to match direct input (think of sscanf("Hello", "Hello")), so the code apparently did not parse the % first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest:&lt;/P&gt;&lt;P&gt;- start with a fresh, wizard generated project.&lt;/P&gt;&lt;P&gt;- make sure you have enough stack space&lt;/P&gt;&lt;P&gt;- copy/paste your simple sscanf code into it&lt;/P&gt;&lt;P&gt;- make sure it compiles without warnings (implicit parameter declarations)&lt;/P&gt;&lt;P&gt;- if that fails, zip it and post the project it here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW: IDE 5.9 refers to the editor/development environment. Really does not narrow the possibilities down.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 11:38:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191651#M6887</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2011-03-17T11:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: sscanf function fails CW 5.9 IDE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191652#M6888</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;Additional question/note from CompilerGuru answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure you include stdio.h in your project&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 13:57:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191652#M6888</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-03-17T13:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: sscanf function fails CW 5.9 IDE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191653#M6889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using sscanf() on a 8- or 16-bit microcontroller? I can't come up with any reason why one would do that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Mar 2011 14:51:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/sscanf-function-fails-CW-5-9-IDE/m-p/191653#M6889</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2011-03-22T14:51:44Z</dc:date>
    </item>
  </channel>
</rss>

