Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program test
- character(len=255) format
- 1 format(9i4)
- c FORMATTED
- open(99,file='form1.txt',form='formatted')
- do i=1,1
- write(99,1) 1, 2, 3, 4, 5, 6, 7, 8, 9
- enddo
- close(99)
- c UNFORMATTED
- open(98,file='form2.txt',form='unformatted')
- do i=1,1
- write(98) 1, 2, 3, 4, 5, 6, 7, 8, 9
- enddo
- close(98)
- c DIRECT ACCESS
- nrec=sizeof(i)*9
- open(97,file='form3.txt',form='unformatted',
- & access='direct',recl=nrec)
- do i=1,1
- write(97,rec=i) 1, 2, 3, 4, 5, 6, 7, 8, 9
- enddo
- close(97)
- call system('ls -lh form?.txt')
- end
- -rw-r--r--. 1 user users 37 May 27 17:10 form1.txt
- -rw-r--r--. 1 user users 44 May 27 17:10 form2.txt
- -rw-r--r--. 1 user users 36 May 27 17:10 form3.txt
- $ xxd form1.txt
- 0000000: 2020 2031 2020 2032 2020 2033 2020 2034 1 2 3 4
- 0000010: 2020 2035 2020 2036 2020 2037 2020 2038 5 6 7 8
- 0000020: 2020 2039 0a 9.
- $ xxd form2.txt
- 0000000: 2400 0000 0100 0000 0200 0000 0300 0000 $...............
- 0000010: 0400 0000 0500 0000 0600 0000 0700 0000 ................
- 0000020: 0800 0000 0900 0000 2400 0000 ........$...
- $ xxd form3.txt
- 0000000: 0100 0000 0200 0000 0300 0000 0400 0000 ................
- 0000010: 0500 0000 0600 0000 0700 0000 0800 0000 ................
- 0000020: 0900 0000 ....
Add Comment
Please, Sign In to add comment