tmpnam Function (tigcc.a)

stdio.h

char *tmpnam (char *s);

Produces a unique random file name.

tmpnam returns a random file name of 8 characters which does not exist on the calculator. If s is NULL, tmpnam returns a pointer to a static buffer, otherwise it fills s and returns a pointer to it. When passing NULL to tmpnam, it is best to treat the pointer returned as if it were pointing to constant data. It is assumed that the buffer pointed to by s is at least 9 bytes long.

tmpnam is capable of returning TMP_MAX or 25^8 combinations. When nearing TMP_MAX, performance decreases significantly, and eventually, the function will run into an infinite loop. These factors, however, should not pose any problems for the currently supported calculator platforms. You will run into the maximum number of handles a lot sooner.

Note: tmpnam does not actually create any files. If you call it twice without creating a file whose name equals the first result, it may, in theory, return the same name again.


Uses: rand