Re: Short records on unformatted reads



Thomas Koenig wrote:

What should the following program print?

program main
implicit none
integer, dimension(2) :: ia
open(10, form="unformatted", status="unknown")
write (10) 1, 'a'
rewind 10
ia = 42
read (10, err=20) ia
20 continue
print '(2I8)', ia
end program main

Is the first number printed required to be 1?

Is the processor free to print garbage as the second number?
print statement prints 1 and 97 with CVF

--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

Why are there two? God only knows.


If you want to do the impossible, don't hire an expert because he knows it can't be done.

-- Henry Ford
.



Relevant Pages

  • Re: WG5-J3 Joint Meeting
    ... I like the idea of a subroutine interface "implicit none" ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: Scope of implicit none
    ... It was a natural to introduce free form source with implicit none as the default. ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: Scope of implicit none
    ... If you remember, IMPLICIT NONE was not even allowed in f77, it would have been strange indeed to make something that was not even allowed in the current language the default in the next revision. ... Support the Original G95 Project: http://www.g95.org ...
    (comp.lang.fortran)
  • Re: The linf project
    ... language and to be honest with you, ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: The linf project (2)
    ... names for a single data type. ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)