Using read(asterisk, asterisk) in Fortran doesn\'t seem to work if the string to be read from the user contains spaces. Consider the following code:
characte
Instead of read(*, *)
, try read(*, '(a)')
. I'm no Fortran expert, but the second argument to read
is the format specifier (equivalent to the second argument to sscanf
in C). *
there means list format, which you don't want. You can also say a14
if you want to read 14 characters as a string, for example.