Reading a file in FORTRAN 90 or 95

  • Context: Fortran 
  • Thread starter Thread starter hamidsv
  • Start date Start date
  • Tags Tags
    File Fortran Reading
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
hamidsv
Messages
3
Reaction score
0
Hi everybody,
I need your help guys. I am using FORTRAN 90(or 95) and try to read a text file. The file contains many lines for instance something like this
CS
DIRECT
1.2 2.5 3.6
1.6 -2.3 2.9
....
....
....
I need to put each line inside a string variable for example
A="CS"
B="DIRECT"
C ="1.2 2.5 3.6 "
....
Please if you know the answer just let me know. I use "READ(1,*,IOSTAT=EOF) A" but the result is totally different.
 
Physics news on Phys.org
Hi, hamidsv:

When it comes to source code, input and results, hand waving does not cut it; please post the actual source code that you are using, an actual sample of the input and the actual results that you are getting...there is no point in trying to help you when you tell us what YOU think what you are doing but the sources say something else.
 
Hi gsal,
Thanks for your quick reply. This time I was able to solve the problem (one of my friends helped me). Next time I try to provide all information if I have any questions.
Thanks again