! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 6.6. List-directed input of (possibly undelimited) character data.
  program G06
    implicit none
    integer, parameter :: S_LEN = 20
    character (len = S_LEN) :: Nutrient
! start program G06
    open (unit = 1, file = "g06.txt", status = "old", action = "read", position = "rewind")
    do
      read (unit = 1, fmt = *) Nutrient
      if (Nutrient == " ") then
        exit
      end if
      write (unit = *, fmt = *) " Your diet should include ", Nutrient
    end do
    stop
  end program G06
