<?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 Re: SD card reading with fopen() in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147679#M62</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 would say it is because of some 'safery' limitation of fscanf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imagine what will happen if someone will provide file bigger than 2K - fscanf have no way of knowing the size of buffer and your application will crash flat ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also "%s" stops reading on space ..., so if LOGO includes space it will only return first word from it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would use fread instead of fscanf ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 09 Jul 2011 01:06:57 GMT</pubDate>
    <dc:creator>RobertSignum</dc:creator>
    <dc:date>2011-07-09T01:06:57Z</dc:date>
    <item>
      <title>SD card reading with fopen()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147678#M61</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to read a text file, 2k of dimension, form sd card, in ESDHC mode.&lt;/P&gt;&lt;P&gt;This is a part of my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void Schermata(char* percorso){&lt;/P&gt;&lt;P&gt;MQX_FILE_PTR fp;&lt;/P&gt;&lt;P&gt;unsigned char LOGO[2049];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; fp=fopen(percorso,"r");&lt;/P&gt;&lt;P&gt;&amp;nbsp; fscanf (fp, "%s", LOGO);&lt;BR /&gt;... &amp;nbsp;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp; fclose(fp);﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but in LOGO I find only the first 256 chars of the file.&lt;/P&gt;&lt;P&gt;Where is the mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks and best regards,&lt;/P&gt;&lt;P&gt;Corrado&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 22:24:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147678#M61</guid>
      <dc:creator>Curro</dc:creator>
      <dc:date>2011-07-08T22:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: SD card reading with fopen()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147679#M62</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 would say it is because of some 'safery' limitation of fscanf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imagine what will happen if someone will provide file bigger than 2K - fscanf have no way of knowing the size of buffer and your application will crash flat ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also "%s" stops reading on space ..., so if LOGO includes space it will only return first word from it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would use fread instead of fscanf ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jul 2011 01:06:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147679#M62</guid>
      <dc:creator>RobertSignum</dc:creator>
      <dc:date>2011-07-09T01:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: SD card reading with fopen()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147680#M63</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks Robert,&lt;/P&gt;&lt;P&gt;no spaces in my .txt but I think the problem is in fscanf "limitations"...&lt;/P&gt;&lt;P&gt;I'll try with fread instead.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Corrado&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jul 2011 03:18:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/SD-card-reading-with-fopen/m-p/147680#M63</guid>
      <dc:creator>Curro</dc:creator>
      <dc:date>2011-07-09T03:18:57Z</dc:date>
    </item>
  </channel>
</rss>

