-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFolders.tex
50 lines (38 loc) · 962 Bytes
/
Folders.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
\chapter{Folders}
\label{chap:folders}
\section{Environment variables}
\label{sec:envir-vari-1}
You can read the value of an environment variable using
\verb!GetEnv()! subroutine.
\begin{lstlisting}
call GetEnv('ENV_VAR', STR)
\end{lstlisting}
put the content of the environment variable \verb!ENV_VAR! to the
string STR.
\section{Get current working directory}
\label{sec:get-current-working}
Use the GNU extension \verb!GetCWD()! function.
\begin{lstlisting}
PROGRAM test_getcwd
CHARACTER(len=255) :: cwd
CALL getcwd(cwd)
WRITE(*,*) TRIM(cwd)
END PROGRAM
\end{lstlisting}
\section{Change folder}
\label{sec:change-folder}
Use GNU extension, {\bf ChDIR}
\begin{lstlisting}
PROGRAM test_chdir
CHARACTER(len=255) :: path
CALL getcwd(path)
WRITE(*,*) TRIM(path)
CALL chdir("/tmp")
CALL getcwd(path)
WRITE(*,*) TRIM(path)
END PROGRAM
\end{lstlisting}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "gpucomputing"
%%% End: