Is there a function in Fortran that inquires the type of operative system? and gives this type as a string or similar? Basically I would like to use the function SYSTEM and run my program both on linux and windows machines. My program employing the function SYSTEM works well on linux but now I want to do it general and run it also on windows. Lets say that this function I am looking for is called INQUIRE_SYSTEM. My program reads:
USE IFPORT
stringSYSTEM = INQUIRE_SYSTEM()
if (TRIM(ADJUSTL(stringSYSTEM).eq.linux)) THEN ! linux systems
I = SYSTEM("mv final.out restart.dat")
If (I == -1) then
errnum = ierrno( )
print *, 'Error ', errnum
end if
else !dos systems
I = SYSTEM("rename final.out restart.dat")
If (I == -1) then
errnum = ierrno( )
print *, 'Error ', errnum
end if
thank you very much for any help. A.