[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Get command line via system calls?



Can one get a program's command line parameters via system or library calls?

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 I could get the argc and argv parameters to main, but I'd like to know if there is some way I can get them without changing my program's entry point.

I looked around in the man pages, and found the getenv function, which fetches the environment, but I didn't see anything about getting command line parameters the way I'm thinking of.

Thanks for your help!

Mike Crawford
crawford@goingware.com

   Read "GoingWare's Bag of Programming Tricks" at:
           http://www.goingware.com/tips/



Reply to: