JCL Help:FileCreateTemp

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Creates a temporary file.


Pascal

 function FileCreateTemp(var Prefix: string): THandle;


Parameters

Parameters Description
var Prefix: string On input the first three characters of the string are used to form the name of the temporary file (can be empty). On return, assuming the function succeeded, Prefix contains the actual name of the temporary file, including the path. On failure the contents of Prefix are undefined.


Return Value

If the function succeeds the result is a handle to the temporary file, on failure the function returns INVALID_HANDLE_VALUE.


Description

FileCreateTemp creates a temporary file in the temporary folder as returned by GetTempPath. The file is created with read and write access and is deleted as soon as it is closed. The file cannot be opened by another call to CreateFile. The file is created with the temporary attribute which means the system will attempt to keep the file's data in memory rather than caching it. Therefore you should close the file as soon as possible using CloseHandle.


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