|
|
 |
 |
 |
 |
Fortran Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
line input
Hello, In Visual Basic there is this command <<Line Input>> which reads a full line from an ASCII file and stores it in a string variable. Is there anything similar in Fortran? I would like to read a comments line (that includes spaces). I know I could parse it but this is such a pain (unless somebody has a parsing routine). Please advice. Thanks Tuli
Hi, On Mar 2, 7:10 pm, "tuli" <tuli.herscov@gmail.com> wrote: > In Visual Basic there is this command <<Line Input>> which reads a > full line from an ASCII file and stores it in a string variable.
The following should work: character(len=256) :: str integer :: myFile = 5 ! open file etc. read(myFile,'(a)') str Note: If you replace the '(a)' by *, only one word is read. Tobias
Hi, On Mar 2, 7:14 pm, "Tobias Burnus" <bur@net-b.de> wrote: > integer :: myFile = 5
And of cause 5 is a bad choice for a file unit as it is on most systems the INPUT_UNIT (0 is usually the ERROR_UNIT, 6 the OUTPUT_UNIT). Tobias
|
 |
 |
 |
 |
|