Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22093

Where does the tmpname function write temporary files in a Sun Solaris environment?

$
0
0

I am in a Unix environment (Sun Ultra 5 with gcc v.2.95.3) and I am trying to understand where my compiler writes temporary files using the tmpnam function. I am aware that this works is deprecated but mine was only curiosity. I acted like this: I ran this source in c:

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    char nomefile[L_tmpnam];

    strcpy(nomefile, "my_file.txt");
    tmpnam(nomefile);

    getchar();

    return(0);
}

while waiting for the return key to be pressed, the program should create a temporary file (somewhere in the file system) named my_file.txt. So from another terminal I start the search in this way (as superuser):

find / -name my_file.txt -print

unfortunately it does not find it. Yet in the book I'm reading it says that this function (tmpnam) unlike the tmpfile function, you can specify the name of the temporary file and write it somewhere in the filesystem.


Viewing all articles
Browse latest Browse all 22093

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>