Cover V02, I06
Article
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6

nov93.tar


Listing 5: tmpname.c

/*
*      TMPNAME.C:
*      Generates a temporary filename (in the /tmp directory).
*  usage:
*      tmpname [<prefix>]
*  where <prefix> specifies the first few chars of the new name.
*/

#include <stdio.h>

main(argc, argv)
int argc;
char **argv;
{
int i, j;
char prefix[20];

prefix[0] = '\0';
if (argc == 2)
strcpy(prefix,argv[1]);

puts(tempnam("/tmp", prefix));
}
/* End of File */