Fortran Running FORTRAN executable from Linux SHELL

Click For Summary
The discussion centers on an issue encountered when running a FORTRAN program in Linux, specifically on a Raspberry Pi using Debian. The user found that executing the program from the command line worked correctly, as it accessed the input file from the current directory and generated an output file. However, when attempting to run the program from the file manager, neither the 'execute' nor 'execute from terminal' options functioned, leading to an EOF error indicating that the input file could not be found. The user discovered that the current directory (curdir) defaults to the home directory when executing from the file manager, regardless of the executable's location. This means that both input and output files must reside in the home directory when run this way. The command line execution remains unaffected by this limitation, and the user noted that GAMBAS3 also operates under the same constraint, not recognizing the concept of curdir. The issue was resolved by understanding this behavior of the file manager and GAMBAS.
jelanier
Messages
67
Reaction score
1
I have noticed an issue I must resolve before writing a GUI for my FORTRAN program in Linux.

If I move into the directory (cmd line) and type ./myprogram it works fine. It reads the input file from that directory and creates an output file.

If I run it from the file manager it gives me 2 options 'execute' or 'execute from terminal'. Neither one works. I don't see anything happening and a new output file is not created.

In GAMBAS3 I tried a shell command which gave me a hint. I got an EOF error. So it could not find the input file. It is as if it is running the FORTRAN program in oblivion instead of from the directory using the directory resources. I tried complete path in the shell as well as cd in the shell.

I also tried compiling the GAMBAS program and moving it into the directory of the FORTRAN program. No Luck.

What am I missing? (using Debian for Raspberry pi)
Jim
 
Technology news on Phys.org
I figured it out. It turns out that no matter where you have the executable, the curdir is always whatever your home directory is. I don't like it but there it is.

So if I run my program from it's directory (in file manager), the input and output files must be in that home directory.

Command line works fine always.

In the case of Gambas, it does not matter where the Gambas executable resides...the home directory is where it looks. Gambas does not even understand the concept of curdir.

Oh well :)

Thanks anyway,

Jim
 
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 1 ·
Replies
1
Views
5K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
3
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 34 ·
2
Replies
34
Views
5K