0

I am trying to open a csv file in fortran but it won't display. I used the following command

open(unit=13, file='C:\\Users\\Smith Family\\Desktop\\Lifetables2.csv')

All I mean is that when I execute this command, nothing happens. There is no output whatsoever. Perhaps I am wrong but I thought that when you use the open command, the file would appear as output. Sorry, I'm a newbie to Fortran.

Sarah
  • 21
  • 2
  • 1
    Dear Angela, please add more details - open command is not displaying anything. It is just opening the file for further operations. Assuming compiler gives no errors, is there any output from execution of your program? How do you try to display file contents? – Marek Apr 05 '17 at 12:37
  • But if I am using the open command, shouldn't the file then open? – Sarah Apr 05 '17 at 12:40
  • 1
    There are many things that can go wrong. What exactly happens? What do you mean by *"shouldn't the file then open"*? How do you determine it is not open? Please supply the details. Read [ask] and [mcve]. – Vladimir F Героям слава Apr 05 '17 at 12:48

1 Answers1

3

There is no output supposed to happen after executing the open statement. Output happens after print or write, never after just open.

What open does is to open the file for access by other statements like read or write so that you can read something from the file, then do something with the values you read and then perhaps write something on the screen. Or to write something into the file.

Read other questions and answers here for examples, but be sure to open a textbook or tutorial and really study the basics. Programming is quite hard, you have to study from some resource. You cannot just do trial and error.

See

Read data from a .csv file in fortran

and many other related questions and answers, but I can guarantee you they will be too dificult to understand unless you study the basics.

Community
  • 1
  • 1