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

  • Context: Fortran 
  • Thread starter Thread starter arhangela
  • Start date Start date
  • Tags Tags
    Fortran Program Value
Click For Summary
SUMMARY

In Fortran 90, variables can be assigned values during program execution using command line arguments. This is achieved by utilizing the intrinsic procedure 'getarg' to retrieve values passed to the program at runtime, such as './exe 100'. The 'read' command is not suitable for this purpose as it requires user input after program execution begins. The discussion highlights the importance of understanding command line argument handling in Fortran 90 for efficient program execution.

PREREQUISITES
  • Basic understanding of Fortran 90 syntax
  • Familiarity with command line operations
  • Knowledge of intrinsic procedures in Fortran
  • Experience with variable declaration and data types in Fortran 90
NEXT STEPS
  • Research 'Fortran 90 command line arguments' for detailed implementation
  • Learn about the 'getarg' intrinsic procedure in Fortran 90
  • Explore examples of passing multiple command line arguments in Fortran
  • Study error handling for command line inputs in Fortran 90
USEFUL FOR

Fortran developers, students learning Fortran 90, and programmers interested in command line argument handling in Fortran applications.

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 :)
 

Similar threads

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