On Thu, 17 Sep 2020 at 15:56, Ken Brown via Cygwin <> wrote:
>

#include <stdio.h>
#include <stdlib.h>
int
main ()
{
    char *temp_nam;
    char *p_tmp_nam;

    printf ("$TMP      is '%s'\n", getenv ("TMP"));
    printf ("$TMPDIR   is '%s'\n", getenv ("TMPDIR"));
    printf ("$TEMP     is '%s'\n", getenv ("TEMP"));
    printf ("P_tmpdir  is '%s'\n", P_tmpdir);
    p_tmp_nam = tmpnam(0);
    printf ("tmpnam()  is '%s'\n", p_tmp_nam);
    temp_nam = tempnam(0, 0);
    printf ("tempnam() is '%s'\n", temp_nam);
    free(temp_nam);
}


# start a new shell
$ sh
$ TMP= TEMP= ./show_tmp
$TMP      is ''
$TMPDIR   is '(null)'
$TEMP     is ''
P_tmpdir  is '/tmp'
tmpnam()  is '/tmp/t707.0'
tempnam() is '/tmp/ffffd187.2'

# start cmd.exe
$ /cygdrive/c/windows/system32/cmd.exe
Microsoft Windows [Version 10.0.18363.1082]
(c) 2019 Microsoft Corporation. All rights reserved.
>set TMP=
>set TEMP=
> show_tmp
$TMP      is '(null)'
$TMPDIR   is '(null)'
$TEMP     is '(null)'
P_tmpdir  is '/tmp'
tmpnam()  is '/tmp/t709.0'
tempnam() is '/tmp/ffffd189.2'

P_tmpdir is defined in <stdio.h>


-- 
Doug Henderson, Calgary, Alberta, Canada - from gmail.com
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to