<?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: fopen - append bug in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202232#M4661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply JKadin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just read theBuffering and Caching on the MQXMFSUG but that's not the problem I am reporting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try it your self and you'll see it (MQX3.6)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open a txt file on any PC and write some lines on it. Save file in USB Pen Drive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plug it in a kit running MQX3.6 MFS and execute fopen with "a" for append&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Write some data to it. You'll see it ovewrites some bytes of the file you created even on another platform...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll consider setting the flag as you suggested. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 Apr 2011 01:28:39 GMT</pubDate>
    <dc:creator>rdazcal</dc:creator>
    <dc:date>2011-04-30T01:28:39Z</dc:date>
    <item>
      <title>fopen - append bug</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202229#M4658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using MQX3.6 and I think I found a bug on MFS in conjuction with a USB Pen Drive...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I open a file in the USB to append data to it with:&lt;/P&gt;&lt;P&gt;fd = fopen("c:\\log.txt", "a")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I write data to it and close it, and it works fine. Every time I log something, it goes to the end of the file preserving previous data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if I insert the USB stick and try loging, it overwrites several bytes in the end of the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I insert the USB Stick and type in the shell: "type log.txt" before I write data into it, it works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you guys seen it? Has that been fixed in MQX3.7?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 20:50:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202229#M4658</guid>
      <dc:creator>rdazcal</dc:creator>
      <dc:date>2011-04-29T20:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: fopen - append bug</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202230#M4659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok... I changed MFS driver a bit and the problem seems to be solved, though I would like to know from you guys the setback of what I did:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In "Freescale MQX 3.6\mfs\source\generic\mfs_write.c", line 179&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed it to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error = MFS_Read_data_sector(drive_ptr, handle_ptr, sector_number, &lt;STRONG&gt;TRUE&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If set to FALSE, it does not read the sector because I guess usually the buffer is already filled?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, let me know what you think of it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 21:42:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202230#M4659</guid>
      <dc:creator>rdazcal</dc:creator>
      <dc:date>2011-04-29T21:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: fopen - append bug</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202231#M4660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;rdazcal&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I saw a bunch of suggestions about using removable media while I was reading about my formatting issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Have you looked into the MQX MFS User's guide, it talks about Buffering and Caching on page 15.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, I thought that maybe you can set a flag on stick insertion that would cause a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;error = MFS_Read_data_sector(drive_ptr, handle_ptr, sector_number, &lt;STRONG&gt;TRUE&lt;/STRONG&gt;); and&lt;/P&gt;&lt;P&gt;error = MFS_Read_data_sector(drive_ptr, handle_ptr, sector_number, &lt;STRONG&gt;False&lt;/STRONG&gt;); if not, which may speed up reading.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2011 00:56:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202231#M4660</guid>
      <dc:creator>JKadin</dc:creator>
      <dc:date>2011-04-30T00:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: fopen - append bug</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202232#M4661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply JKadin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just read theBuffering and Caching on the MQXMFSUG but that's not the problem I am reporting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try it your self and you'll see it (MQX3.6)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open a txt file on any PC and write some lines on it. Save file in USB Pen Drive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plug it in a kit running MQX3.6 MFS and execute fopen with "a" for append&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Write some data to it. You'll see it ovewrites some bytes of the file you created even on another platform...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll consider setting the flag as you suggested. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2011 01:28:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/fopen-append-bug/m-p/202232#M4661</guid>
      <dc:creator>rdazcal</dc:creator>
      <dc:date>2011-04-30T01:28:39Z</dc:date>
    </item>
  </channel>
</rss>

