Fortran Fortran 90: giving the variable's value on the execution of a program

Click For Summary
In Fortran 90, it is possible to define a variable whose value can be provided at runtime through command line arguments. Instead of using the "read" command, which requires input after the program starts, users can pass values directly when executing the program, such as with the command "./exe 100". The discussion highlights the importance of searching for "Fortran 90 command line arguments" to find relevant resources and examples. This approach allows for more efficient input handling during program execution.
arhangela
Messages
2
Reaction score
0
Hello

I wondered if in Fortran 90 I can define a variable whose value will be given only while executing the program, in the same line as the execution command, for example like this:

./exe 100

I know one can use the "read" command, but that way you only enter the variable's value once the program is executed (in a new line)

I tried to Google it but I'm new to Fortran and I'm not sure to know the right terms to look for it efficiently.

Thanks!
 
Technology news on Phys.org
arhangela said:
I tried to Google it but I'm new to Fortran and I'm not sure to know the right terms to look for it efficiently.

Try Googling for

fortran 90 command line arguments

The first page has several references that look promising.
 
Thanks jtbell! It works now :)
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
11K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K