C Library Functions  - get_tmp (3)

NAME

get_tmp(3f) - [M_io:QUERY] Return the name of the scratch directory (LICENSE:PD)

CONTENTS

Synopsis
Description
Examples
Author
License

SYNOPSIS

function get_tmp() result(tname)

     character(len=:),allocatable :: tname

DESCRIPTION

Return the name of the scratch directory set by the most common environment variables used to designate a scratch directory. $TMPDIR is the canonical environment variable in Unix and POSIX[1] to use to specify a temporary directory for scratch space. If $TMPDIR is not set, $TEMP, $TEMPDIR, and $TMP are examined in that order. If nothing is set "/tmp/" is returned. The returned value always ends in "/". No test is made that the directory exists or is writable.

EXAMPLES

Sample:

    program demo_get_tmp
    use M_io, only : get_tmp, uniq
    implicit none
    character(len=:),allocatable :: answer
       answer=get_tmp()
       write(*,*)’result is ’,answer
       answer=get_tmp()//uniq(’_scratch’,create=.false.)
       write(*,*)’the file ’,answer, &
       & ’ was a good scratch file name, at least a moment ago’
    end program demo_get_tmp

Sample Results:

    > result is /cygdrive/c/Users/JSU/AppData/Local/Temp/
    >
    > the file /cygdrive/c/Users/JSU/AppData/Local/Temp/_scratch
    > was a good scratch file name, at least a moment ago

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 get_tmp (3) February 23, 2025
Generated by manServer 1.08 from b42bcc36-a46b-4ddc-984e-2854ed8f1eb1 using man macros.