Fortran Is it possible to call shell commands from a Fortran program?

  • Thread starter Thread starter yo6781
  • Start date Start date
  • Tags Tags
    Fortran Shell
Click For Summary
Combining Fortran with MATLAB on Ubuntu 7.10 without using mex-functions or MATLAB engine functions is a concern for some users due to potential risks to the Fortran program. A suggested method involves using the "system" subroutine available in the gfortran compiler, which allows for shell calls. However, caution is advised as this approach can lead to compiler dependency issues. Users are encouraged to explore this option while considering the implications on code portability and stability.
yo6781
Messages
1
Reaction score
0
Hello!

I'm new here and I was wondering if anyone could help me.

I've a program in fortran which I want to combine with Matlab, both working in Ubunt 7.10 but I don't want to use mex-functions or MATLAB engine functions because it could cause damage to the fortran program I'm using. I was wondering if it would be possible to do it with a calling to the shell. Does anybody know if it is possible and how could I do it??

Thank you
 
Technology news on Phys.org
If you are using the gfortran compiler there is a subroutine called "system" http://gcc.gnu.org/onlinedocs/gfortran/SYSTEM.html" . But be aware about that this makes your code compiler dependent, so if it is possible you should avoid to use it.
 
Last edited by a moderator:
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 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
16
Views
3K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K