<?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>MQX Software SolutionsのトピックHow I can write a EOF?</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167976#M1712</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;I initialize the io-driver for memory with this code. That works well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;uint8_t memory [4000]; uint32_t mem_init (void){    MQX_FILE_PTR    drive_p        = NULL;    _mqx_uint       error_code      = 0;     if ( (error_code = _io_mem_install(NAME_OF_FILE, memory, sizeof(memory))) == MQX_OUT_OF_MEMORY)                               {                                               printf("could not install drive\n");                                               return 1;                               }     //!____Open_the_drive______________________________________________________    drive_p = _io_fopen( NAME_OF_FILE, "r");    if (drive_p == NULL )    {        printf("unable to open %s\n", NAME_OF_FILE);        return 1;    }   //!___close________________________________________________________________    _io_fclose(drive_p);    return 0;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that, I open again with:&lt;/P&gt;&lt;PRE&gt;pDataFile  = fopen(NAME_OF_FILE, "w+");&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and write some lines with:&lt;/P&gt;&lt;PRE&gt;fprintf(pDataFile, "%s\n", buffer);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until this point everything works well. Now I read out all lines until the function “_io_fgetline()” receive “IO_EOF”. But I get much more (empty) lines as I have written before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why the driver does not set the EOF automatically?&lt;/P&gt;&lt;P&gt;Can I set explicit the “End Of File”?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:15:41 GMT</pubDate>
    <dc:creator>soli</dc:creator>
    <dc:date>2020-10-29T09:15:41Z</dc:date>
    <item>
      <title>How I can write a EOF?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167976#M1712</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;I initialize the io-driver for memory with this code. That works well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;uint8_t memory [4000]; uint32_t mem_init (void){    MQX_FILE_PTR    drive_p        = NULL;    _mqx_uint       error_code      = 0;     if ( (error_code = _io_mem_install(NAME_OF_FILE, memory, sizeof(memory))) == MQX_OUT_OF_MEMORY)                               {                                               printf("could not install drive\n");                                               return 1;                               }     //!____Open_the_drive______________________________________________________    drive_p = _io_fopen( NAME_OF_FILE, "r");    if (drive_p == NULL )    {        printf("unable to open %s\n", NAME_OF_FILE);        return 1;    }   //!___close________________________________________________________________    _io_fclose(drive_p);    return 0;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that, I open again with:&lt;/P&gt;&lt;PRE&gt;pDataFile  = fopen(NAME_OF_FILE, "w+");&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and write some lines with:&lt;/P&gt;&lt;PRE&gt;fprintf(pDataFile, "%s\n", buffer);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until this point everything works well. Now I read out all lines until the function “_io_fgetline()” receive “IO_EOF”. But I get much more (empty) lines as I have written before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why the driver does not set the EOF automatically?&lt;/P&gt;&lt;P&gt;Can I set explicit the “End Of File”?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:15:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167976#M1712</guid>
      <dc:creator>soli</dc:creator>
      <dc:date>2020-10-29T09:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: How I can write a EOF?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167977#M1713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Noone can help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2012 16:07:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167977#M1713</guid>
      <dc:creator>soli</dc:creator>
      <dc:date>2012-06-12T16:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: How I can write a EOF?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167978#M1714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nico!&lt;/P&gt;&lt;P&gt;Thanks for your patience, and apologizes for the delay.&lt;/P&gt;&lt;P&gt;Out technicians will be shortly addressing your questions!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Monica &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2012 00:22:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167978#M1714</guid>
      <dc:creator>Monica</dc:creator>
      <dc:date>2012-11-09T00:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: How I can write a EOF?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167979#M1715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I think if after the fprintf() call you do a fflush() it will help.&lt;/P&gt;&lt;P&gt;I've seen other post where once you write to file, then fclose(), then re open.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 18:17:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167979#M1715</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2012-11-14T18:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: How I can write a EOF?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167980#M1716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello nico,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fprintf returns number of bytes written. Check return value of fprintf and afterwards read written characters back from file and compare if numbers are equal.&lt;/P&gt;&lt;P&gt;As david pointed out, fflush also might help to write remaining unwritten data if this situation happened in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any of these help, get back to us with code snippet what we actually can test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MartinK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 07:01:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-I-can-write-a-EOF/m-p/167980#M1716</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2012-11-15T07:01:42Z</dc:date>
    </item>
  </channel>
</rss>

