06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pREPC+ <strong>System</strong> <strong>Calls</strong> tmpnam<br />

tmpnam Generates a temporary filename.<br />

#include <br />

#include <br />

char *tmpname(<br />

char *s /* string root */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

The tmpnam() function generates a string that is intended to be used as a filename.<br />

tmpname() generates up to 1000 unique names for each task. The pREPC+ library<br />

does not maintain a list of tmpnames in use. After 1000 names have been<br />

generated, the sequence starts over.<br />

A file with a name generated by tmpnam() is not necessarily a temporary file. To be<br />

treated as a temporary file, it must be created by tmpfile().<br />

s Points to the string where tmpname() stores the filename.<br />

When tmpname() is called, s should consist of the initial part of a<br />

valid pathname. tmpname() adds a slash (/), followed by a T (or G if<br />

the creating task is global). The T (or G) is followed by the lower 16bits<br />

of the caller's task ID, which is followed by a decimal point and a<br />

decimal number within the range 0 through 999.<br />

For example, assume that s points to the string 0.0; the caller's tid is<br />

00000002; and the caller has previously called tmpname() 12 times.<br />

The generated name is 0.0/T0002.012.<br />

This function returns a pointer to the generated name.<br />

Refer to Appendix B.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 3-177<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!