Hi.
Which functions/subroutines can be used instead of
delfilesqq
createdirqq
hostnm
getlog
in Linux?
Hi.
Which functions/subroutines can be used instead of
delfilesqq
createdirqq
hostnm
getlog
in Linux?
See Chapter 9 of
https://www.pgroup.com/doc/pgifortref.pdf for fortran versions of
several C system routines.
integer function system(character*(*) str)
can be used for many system commands. It returns a zero if successful.
delfilesqq integer function unlink(character*() filename)
createdirqq I=system(“mkdir dirname”)
hostnm integer function hostnm(character() nm)
getlog character(*) function getlog()
dave
Compiler cannot understand hostnm and getlog.
Compiler version is 16.5.
danger3% more hostnm_getlog_ex.f
program hostnm_getlog_ex
integer hostnm,i
character32 getlog
character32 name,username
i=hostnm(name)
username=getlog()
if (i .eq. 0) then
print *,"hostname is ",name
else
print *,“hostnm failed- returned”,i
end if
print *,"getlog returns the username ", username
end
danger3% pgfortran -o hostnm_getlog_ex hostnm_getlog_ex.f
danger3% whoami
tull
danger3% hostnm_getlog_ex
hostname is danger3
getlog returns the username tull