[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: mktemp()



Hello,

You can also get around this by having a character array instead of a
pointer.

- ---------------------------------------------
#include <unistd.h>
#include <stdio.h>
main()
{
        char filename[20]="temp.XXXXXX";
        char *retval;

        retval=mktemp(filename) ;

        if (retval == NULL);
                perror("mktemp");

        printf("Temp file name: %s\n", s);

}
- ---------------------------------------------
I have a small problem here :
The filename is generated no doubt, but mktemp() is returning NULL.


Regards,
Shekhar


> 
> 
> 
> i tried a code with mktemp() system call to generate a random filename.it
> fail with a core dump.the same thing works on solaris
> 
> 
> 
> any ideas why it is failing

- --------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
Please do not post HTML email to this mailing list.  HTML mails will be
thoroughly ignored and derisively sniggered at in private.

------------------------------