Re: system function to determine OS
- From: user1 <user@xxxxxxxxxxx>
- Date: Wed, 25 Mar 2009 15:35:15 -0400
John Appleyard wrote:
Since this information is known at compile time, I think the best solution is to define a parameter with the value in, and stick it in a module. Then just uncomment the right one at compile time.
"Clever" ways to do this at run-time are liable to come unstuck when Apple/MS/Linux change the rules without telling you.
INTEGER,PARAMETER :: MAC=1,WINDOWS=2,LINUX=3
INTEGER,PARAMETER :: OS=MAC
!! INTEGER,PARAMETER :: OS=WINDOWS
!! INTEGER,PARAMETER :: OS=LINUX
Interesting. If doing this in C, I would use preprocessor macros and compile my program with cc -DUSING_MAC, cc -DUSING_LINUX, or cc -DUSING_WINDOWS.
My program would contain blocks like
--- do mac stuff ...
--- do linux stuff ...
--- do windows stuff ...
Is there a Fortran analog to this ?
- Prev by Date: Re: system function to determine OS
- Next by Date: Re: Unexpected 15 digits precision from "REAL"
- Previous by thread: Re: system function to determine OS
- Next by thread: Re: system function to determine OS