Re: Get command line via system calls?
On Monday 21 March 2005 14:40, Michael D. Crawford wrote:
> I'm looking for a *portable* way to get the command line in a FORTRAN 77
> program. That version of FORTRAN didn't provide command line parameters
> in a portable way. One can get them, but the code required is not
> portable between compilers. Each environment provides a different way.
>
> The obvious solution would be for me to start the program in C code, so
High-level languages are bound to startup wrappers when compiled, and (at
least on non-unix machines like Amiga) these wrappers usually get the params
from the actual call that starts them running. They do some parsing and pass
that on to your code.
So I think you're either going to have to access the /proc filesystem as
someone suggested, or somehow request the process data from your compiler's
support libraries.
I don't know fortran personall, but I'd guess your options are:
* find a fortran compiler that is more cross-platform (and therefore probably
provides the same APIs across those platforms)
* Abstract the non-portable calls behind a function that figures out which
platform you're on and does the correct thing, while being easy to extend for
new platforms.
--
Lee.
Reply to: