Re: backspace error (reading file from the end)
- From: "David Frank" <dave_frank@xxxxxxxxxxx>
- Date: Mon, 7 Aug 2006 03:40:41 -0400
"leaf" <vuckerster@xxxxxxxxx> wrote in message
news:1154930631.268787.138040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Rules and Behavior
Use the BACKSPACE statement with files connected for sequential access.
BACKSPACE cannot be used to skip over records that have been written
using list-directed or namelist formatting.
I have never had a problem with CVF backspacing records from eof position
(file opened with append access at eof)
that were written using list-directed formatting (see below test)
! ------------------------------
program CVF_backspace_test
character(80) :: line
integer :: i(4)
open (1,file='test.dat') ! create file using list i/0
write (1,*) "rec=1",1,11,111
write (1,*) "rec=2",1,2,3,4
write (1,*) "rec=3",3,33333
close (1)
open (1,file='test.dat',position='append')
backspace(1)
backspace(1)
read (1,*) line,i
write (*,91) trim(line),i ! outputs: rec=2 1 2 3 4
91 format (a,4(1x,i0))
end program
.
- References:
- backspace error (reading file from the end)
- From: igor
- Re: backspace error (reading file from the end)
- From: leaf
- backspace error (reading file from the end)
- Prev by Date: Re: can an allocatable array be really dynamic?
- Next by Date: Re: can an allocatable array be really dynamic?
- Previous by thread: Re: backspace error (reading file from the end)
- Next by thread: Re: backspace error (reading file from the end)
- Index(es):
Relevant Pages
|