Run External File.exe Through Fortran 90 - Answered

  • Context: Fortran 
  • Thread starter Thread starter andredoc
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

To run an external executable file in Fortran 90, utilize the call system("commandline") function. This method is effective across various Fortran compilers, although its compatibility may vary. For optimal results, consider redirecting the output of the executable to a file and then reading that file within your Fortran program. This approach enhances data management and ensures that the output is accessible for further processing.

PREREQUISITES
  • Basic understanding of Fortran 90 programming
  • Familiarity with system commands in programming
  • Knowledge of file I/O operations in Fortran
  • Experience with command line interfaces
NEXT STEPS
  • Research the call system function in Fortran 90
  • Learn about file I/O operations in Fortran for handling output
  • Explore different Fortran compilers and their compatibility with system calls
  • Investigate error handling techniques for system calls in Fortran
USEFUL FOR

Fortran developers, MSc students in computational sciences, and programmers looking to integrate external executable files into their Fortran applications.

andredoc
Messages
5
Reaction score
0
Hi! I'm a MSc student and for the development of my dissertation I need to implement a simple fortran 90 program. I'm aware of the basic features of this language but I can't seem to find how to run an executable file (an external file) through fortran. My question is, how can I make the fortran code to run an external "file.exe"?

It's a basic question, but I haven't found an answer so far.

Thanks

Best regards

André
 
Technology news on Phys.org
Something like:
call system("commandline")

ps. Haven't used this myself recently - don't know if it is standard in all compilers.
I also haven;t used it to read data back from the system call - you might be better writing the output of the call to a file and readign the file from fortran.
 
Last edited:
Mgb_phys, with the call system comand my program is working, thanks!
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
16
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K