mktemp

Mark Purtill Purtill at MIT-MULTICS.ARPA
Fri Mar 22 09:25:06 AEST 1985


>>         mktemp ("/tmp/fooXXXXXX");
>>                   becomes
>>         mktemp ( (char *) "/tmp/fooXXXXXX");
>Even better, it becomes
>          char tempstr[14+1];
>          strcpy(tempstr, "/tmp/fooXXXXXX");
>          mktemp(tempstr);
Wouldn't it be better to have the mktemp routine do the copying for you?
When the compiler is changed to make it ANSI standard, presumably mktemp
will be to, and if not,

void _mktemp (const char foo[]) {
     char tempstr[14+1];

     strcpy(tempstr, "/tmp/fooXXXXXX");
     mktemp(tempstr);
     }

#define mktemp _mktemp

in a header file is probably easier than changing all the references to
mktemp in all your programs.  (By the way, what does mktemp do?)

Mark



More information about the Comp.lang.c mailing list