program newunit_example implicit none integer :: unit_number, temp_unit character(len=50) :: text ! Regular file open(newunit=unit_number, file='testfile.txt', action='write') write(unit_number, *) 'Hello Fortran!' close(unit_number) ! Scratch file open(newunit=temp_unit, status='scratch', action='readwrite') write(temp_unit, '(F8.4)') 1.23 rewind(temp_unit) read(temp_unit, '(A)') text print *, 'Read from scratch file:', trim(text) close(temp_unit) end program newunit_example