program main
  implicit none
  integer, pointer :: n
  real(8), pointer :: x
  character(7), pointer :: str
  integer, pointer :: stat

  allocate(stat, n, x, str)
  stat = -9
  n = 1_8
  x = 7.85d0
  str = 'xyzxyz'

  allocate(stat)
  stat = -9

  call write_binary(n, x, str, len(str), stat)
  print*, 'write_binary stat', stat

  print*, 'Initialize values.'
  n = 0
  x = 0.d0
  str = ''

  call read_binary(n, x, str, len(str), stat)
  print*, 'read_binary stat', stat
  print*, n, x, str
end program main