Command line argument in fortarn 77

  • Thread starter Thread starter Manojg
  • Start date Start date
  • Tags Tags
    Argument Line
Click For Summary
SUMMARY

Passing command line arguments in FORTRAN 77 can be achieved using the Intel Fortran Compiler by utilizing the getarg function. Specifically, the syntax call getarg(1, buffer) allows the program to retrieve the first command line argument into the variable buffer. Subsequently, the read(buffer,*) variable statement assigns the value of the argument to the variable. This method enables users to execute the program with arguments, such as $ ./my_program abc, effectively setting variable to abc.

PREREQUISITES
  • Understanding of FORTRAN 77 syntax and structure
  • Familiarity with Intel Fortran Compiler commands
  • Basic knowledge of command line interface operations
  • Experience with variable declaration and input/output operations in FORTRAN
NEXT STEPS
  • Explore the Intel Fortran Compiler documentation on getarg function
  • Learn about error handling for command line arguments in FORTRAN
  • Investigate advanced input/output techniques in FORTRAN 77
  • Study differences in command line argument handling between FORTRAN and C/C++
USEFUL FOR

FORTRAN developers, particularly those working with legacy code, and programmers transitioning from C/C++ to FORTRAN who need to understand command line argument handling.

Manojg
Messages
47
Reaction score
0
Hi,

How can I pass command line argument in FORTRAN 77, like in C/C++?

Thanks.
 
Technology news on Phys.org

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
7
Views
3K
Replies
13
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K