#include #include /******************************************************************************/ /* */ /* GetTempDirectory - this function will return the temp directory in the */ /* environment variable TEMP or /tmp. */ /* */ /* returns a pointer to the a static temp directory */ /* */ /******************************************************************************/ char *GetTempDirectory () { char *temp_val = NULL; static char tmpDir [255]; if ((temp_val = getenv ("TEMP")) == NULL) { strcpy (tmpDir, "/tmp"); } else { strcpy (tmpDir, temp_val); } return tmpDir; } char *GetTempDirectory_r (char *tmpDir, int len) { char *temp_val = NULL; if ((temp_val = getenv ("TEMP")) == NULL) { strncpy (tmpDir, "/tmp", len); } else { strncpy (tmpDir, temp_val, len); } return tmpDir; }