using "newunit"

This commit is contained in:
tth 2022-02-08 13:25:56 +01:00
parent c8d490b8be
commit 6094e29efd

View File

@ -7,8 +7,7 @@ program genbloubs
character(200) :: filename character(200) :: filename
character(30) :: str character(30) :: str
type(t_bloubs) :: bloub type(t_bloubs) :: bloub
integer :: idu
integer, parameter :: idu = 33
i = IARGC() i = IARGC()
if (i .ne. 2) then if (i .ne. 2) then
@ -24,14 +23,15 @@ program genbloubs
! print *, "generating ", nbbloubs, "bloubs to ", filename ! print *, "generating ", nbbloubs, "bloubs to ", filename
open(unit=idu, file=trim(filename), form='unformatted', & open(newunit=idu, file=trim(filename), form='unformatted', &
action='write', status='replace') action='write', status='replace')
do i = 1, nbbloubs do i = 1, nbbloubs
bloub%nick = 'noname ' bloub%nick = 'noname '
bloub%alive = .TRUE. bloub%alive = .TRUE.
call random_pv(bloub) call random_pv(bloub)
bloub%radius = 0.028 bloub%radius = 0.030
bloub%seq = 0 bloub%seq = 0
write(idu) bloub ! no error control ? write(idu) bloub ! no error control ?