JCL Help:FileGetTempName

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Returns the name for a temporary file.


Pascal

 function FileGetTempName(const Prefix: string): string;


Parameters

Parameters Description
const Prefix: string On input the first three characters of the string are used to form the name of the temporary file (can be empty).


Return Value

If the function succeeds it returns a fully qualified filename. If it fails it returns an empty string.


Description

FileGetTempName constructs a fully qualified filename based on system settings (such as a designated folder for temporary files) and the supplied prefix. As the name suggests, this is mostly useful when you need to create a temporary file. Warning (Unix): Between the time the pathname is constructed and the file is created another process might have created a file with the same name using tmpnam, leading to a possible security hole. The implementation generates names which can hardly be predicted, but when opening the file you should use the O_EXCL flag. Using tmpfile or mkstemp is a safe way to avoid this problem.


About

Unit

JclFileUtils


Donator

Marcel van Brakel (Windows) Robert Rossmair (Unix)


Platforms

Windows Unix


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page