go_fu.F90 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. !
  2. ! Fortran file units.
  3. !
  4. module GO_FU
  5. implicit none
  6. ! --- in/out ------------------------------
  7. private
  8. public :: goStdIn, goStdOut, goStdErr
  9. public :: goFuRange
  10. ! --- const ---------------------------------
  11. ! standard file units
  12. integer, parameter :: goStdErr = 0
  13. integer, parameter :: goStdIn = 5
  14. integer, parameter :: goStdOut = 6
  15. ! range of file units that may be used by this program:
  16. integer, parameter :: goFuRange(2) = (/0,999/)
  17. end module GO_FU
  18. !*********************************************
  19. ! Test program to identify unit numbers for standard input etc.
  20. ! Compile:
  21. ! f90 -o test.exe test.f90
  22. ! Run and see what comes to the terminal:
  23. ! test.exe
  24. ! Files named 'fort.<fu>' will be created for not-special units.
  25. ! Error message when writing to standard input;
  26. ! change the range of file units, uncomment the test lines,
  27. ! and execute:
  28. ! echo 'hello' | test.exe
  29. ! Change the range of file units if nothing happends.
  30. !
  31. !program test_fu
  32. !
  33. ! integer :: fu
  34. ! character(len=10) :: s
  35. !
  36. ! do fu = 0, 10
  37. ! write (*,*) 'try to write to file unit ', fu
  38. ! write (fu,*) 'THIS IS FILE UNIT ', fu
  39. ! end do
  40. !
  41. ! ! uncoment following line to check standard input:
  42. ! !read (5,*) s
  43. ! !print *, 'read from standard input: ', s
  44. !
  45. !end program test_fu
  46. !
  47. !*********************************************