<?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 Stream IO returns wrong file position in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837792#M56182</link>
    <description>Very interesting. It's the READ after the initial WRITE that is creating the confusion - while the WRITEs are doing what you ask, the INQUIRE is getting the position wrong because of the READ. If I remove that READ, then everything works right. Escalated as issue DPD200168946&lt;SPAN style="color: blue;"&gt; .&lt;BR /&gt;&lt;/SPAN&gt;</description>
    <pubDate>Fri, 29 Apr 2011 20:41:10 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2011-04-29T20:41:10Z</dc:date>
    <item>
      <title>Stream IO returns wrong file position</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837791#M56181</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I am using stream io in my fortran code. There is one behavior that I don't understand. The following is a test code shows my confusion. I am using visual studio 2008 and the latest intel fortran compiler. The code is compiled with 4 byte integers. &lt;BR /&gt;&lt;BR /&gt;!=========================&lt;BR /&gt;program main&lt;BR /&gt;&lt;BR /&gt;integer :: uf=10, location&lt;BR /&gt;integer :: a = 3, b = 4, c = 5, d = 6&lt;BR /&gt;integer :: x1, x2, x3, x4&lt;BR /&gt;&lt;BR /&gt;open(unit = uf, file='test.dat', access='stream', form='unformatted', status = 'replace', action='readwrite')&lt;BR /&gt;&lt;BR /&gt;write(unit = uf, pos = 1) a&lt;BR /&gt;inquire(unit = uf, pos = location) ! location = 5, OK&lt;BR /&gt;read(unit=uf, pos=1) a&lt;BR /&gt;inquire(unit=uf, pos=location) ! location = 5, OK&lt;BR /&gt;&lt;BR /&gt;!&lt;BR /&gt;! At this point, location = 5. Everything looks ok.&lt;BR /&gt;&lt;BR /&gt;write(unit=uf, pos=location) b ! write b to 'location', which is 5.&lt;BR /&gt;inquire(unit=uf, pos=location) &lt;BR /&gt;print *, location ! output: 5  How can this be? I thought this should be 9, which is 5 + 4&lt;BR /&gt;&lt;BR /&gt;! Anyway, write an integer to the default pos ( I thought the default pos would be 5 &lt;BR /&gt;! because the above inquire function said so, and therefore, 'c' would overwrite 'b'.).&lt;BR /&gt;write(unit=uf ) c&lt;BR /&gt;inquire(unit=uf, pos=location) &lt;BR /&gt;print *, location ! output: 9  which is 5 + 4.&lt;BR /&gt;&lt;BR /&gt;! write antoher integer&lt;BR /&gt;write(unit=uf ) d&lt;BR /&gt;inquire(unit=uf, pos=location) &lt;BR /&gt;print *, location ! output 13  which is 9 + 4.&lt;BR /&gt;&lt;BR /&gt;read(unit=uf, pos=1) x1 &lt;BR /&gt;read(unit=uf) x2 &lt;BR /&gt;read(unit=uf) x3 &lt;BR /&gt;read(unit=uf) x4 ! This read passed, there are indeed 4 integers written to the file&lt;BR /&gt;&lt;BR /&gt;print *, x1, x2, x3, x4 ! output: 3 4 5 6 ! why? I thought the output will be 3 5 6 &lt;BR /&gt;&lt;BR /&gt;close(uf)&lt;BR /&gt;end program &lt;BR /&gt;!=========================&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for help!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Xin</description>
      <pubDate>Fri, 15 Apr 2011 12:09:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837791#M56181</guid>
      <dc:creator>xin_xu</dc:creator>
      <dc:date>2011-04-15T12:09:29Z</dc:date>
    </item>
    <item>
      <title>Stream IO returns wrong file position</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837792#M56182</link>
      <description>Very interesting. It's the READ after the initial WRITE that is creating the confusion - while the WRITEs are doing what you ask, the INQUIRE is getting the position wrong because of the READ. If I remove that READ, then everything works right. Escalated as issue DPD200168946&lt;SPAN style="color: blue;"&gt; .&lt;BR /&gt;&lt;/SPAN&gt;</description>
      <pubDate>Fri, 29 Apr 2011 20:41:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837792#M56182</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-04-29T20:41:10Z</dc:date>
    </item>
    <item>
      <title>Stream IO returns wrong file position</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837793#M56183</link>
      <description>Thanks Steve! &lt;BR /&gt;&lt;BR /&gt;Agreed. I have prevously guessed that there are separate file position values for read and write. But it does not seems a valide guess.&lt;BR /&gt;&lt;BR /&gt;Anyway, hope it will be resolved soon.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Xin&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Apr 2011 20:54:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837793#M56183</guid>
      <dc:creator>xin_xu</dc:creator>
      <dc:date>2011-04-29T20:54:58Z</dc:date>
    </item>
    <item>
      <title>Stream IO returns wrong file position</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837794#M56184</link>
      <description>This has been fixed for a future version. The library was not properly keeping track of the position for reporting purposes.</description>
      <pubDate>Wed, 01 Jun 2011 22:07:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837794#M56184</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-06-01T22:07:49Z</dc:date>
    </item>
    <item>
      <title>Stream IO returns wrong file position</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837795#M56185</link>
      <description>Thanks very much for the info! &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Xin</description>
      <pubDate>Thu, 02 Jun 2011 15:33:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Stream-IO-returns-wrong-file-position/m-p/837795#M56185</guid>
      <dc:creator>xin_xu</dc:creator>
      <dc:date>2011-06-02T15:33:42Z</dc:date>
    </item>
  </channel>
</rss>

