<?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 File opening and closing from different functions within a task. in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351849#M11447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If function A opens a device as a file then calls function B that opens this same device, writes, closes, and returns what is the state of the file that function A is referencing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;f = open()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B(); // Opens same file, writes and closes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write(f, ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close(f)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Sep 2014 17:17:41 GMT</pubDate>
    <dc:creator>razed11</dc:creator>
    <dc:date>2014-09-09T17:17:41Z</dc:date>
    <item>
      <title>File opening and closing from different functions within a task.</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351849#M11447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If function A opens a device as a file then calls function B that opens this same device, writes, closes, and returns what is the state of the file that function A is referencing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;f = open()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B(); // Opens same file, writes and closes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write(f, ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close(f)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 17:17:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351849#M11447</guid>
      <dc:creator>razed11</dc:creator>
      <dc:date>2014-09-09T17:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: File opening and closing from different functions within a task.</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351850#M11448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In fact, open (fopen) creates data (file pointer) in RAM, therefore you have to call close (fclose) in both functions. &lt;/P&gt;&lt;P&gt;However current version of MFS doesn’t allow you to open one file twice for write. MFS isn’t prepared for simultaneous write to one file and this situation should be handled by error code when you try opening file for write for the second time (I didn’t test it). &lt;/P&gt;&lt;P&gt;For now, I do not see any reason why I would like to open one file twice in the same task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, next version of MFS will contain this feature (you can write simultaneously) and this new version of MFS will be available in next MQX release (probably MQX 4.2).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;RadekS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 10:31:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351850#M11448</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2014-09-11T10:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: File opening and closing from different functions within a task.</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351851#M11449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had written a class for debug output that I might want to instantiate on the stack as any random point. I was trying to figure out how to handle the case where I might already have the file open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for responding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 16:36:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351851#M11449</guid>
      <dc:creator>razed11</dc:creator>
      <dc:date>2014-09-11T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: File opening and closing from different functions within a task.</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351852#M11450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And about a fopen for write and another fopen to read in the same file, is any problem is MQX4.1.1 ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 12:07:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/File-opening-and-closing-from-different-functions-within-a-task/m-p/351852#M11450</guid>
      <dc:creator>thiagow</dc:creator>
      <dc:date>2015-10-14T12:07:50Z</dc:date>
    </item>
  </channel>
</rss>

