A safer Read call in Fortran 95
In Fortran, the validation process is a more painful procedure in comparison with other programming environments. In the following code, a much more safer version of the Read subroutine is called, named SafeReadInteger. The syntax and the definition of the function is shown in the following code segment: program TestSafeRead implicit none integer(4) :: iValue !call SafeReadInteger("Enter the number of cylinders", iValue, "Wrong stuff") call SafeReadInteger("Enter the number of cylinders", iValue) print '(A, I4)', "The entered number of cylinders is: ", iValue contains subroutine SafeReadInteger(promptMessage, outVariable, errorMessage) character(*), intent(in) :: promptMessage, errorMessage !the errorMessage is optional optional :: errorMessage integer(4), intent(out) :: outVariable !local variable to receive the integer value integer(4) :: iostatus do !print the promptMessage on the screen and !retain the cursor p...