FairCom DB supports the ability to set a default path for c-tree temporary files in standalone or LOCLIB mode. This feature is useful for setting the path for temporary files created when rebuilding or compacting c-tree files. FairCom DB supports this ability with the configuration keyword TMPNAME_PATH.
To use this feature, first initialize FairCom DB and then set the c-tree global variable ct_tmppth to point to a buffer containing the name of the desired temporary path. Include the path separator at the end of the path name. The buffer may be dynamically allocated. If so, you must also free the buffer when it is no longer needed and set ct_tmppth to NULL.
Example
/* Allocate buffer for temporary file path. */
if (!(ct_tmppth = mballc(1, MAX_NAME)))
printf("Error: Failed to allocate %d bytes for temp path buffer\n", MAX_NAME);
/* Set temporary file path. */
#ifdef ctPortWIN32
strcpy(ct_tmppth, "temp\\");
#else
strcpy(ct_tmppth, "temp/");
#endif
/* Call a function such as CMPIFIL that uses temp path. */
...
/* Done with temp path buffer, so free it. */
if (ct_tmppth) {
mbfree(ct_tmppth);
ct_tmppth = NULL;
}