I am following a Fortran tutorial, however the below code does not seem to work. I am trying to read a 2 digit number from command line, however I get the error UNIT specification at "TRIM(buffer)" must be an INTEGER expression or a CHARACTER variable.
INTEGER :: number
CHARACTER(LEN=20) :: buffer
buffer = ""
CALL GET_COMMAND_ARGUMENT(1, buffer)
READ(TRIM(buffer), FMT="(I2)") number
So the issue as I understand it, is that READ is not sure that the output of TRIM will return a CHARACTER value. Can I somehow declare that it is a CHARACTER or is there another way of getting around this issue?
For what it is worth I am using gfortran.