I have seen that Windows uses temporary files to improve the performance of some tasks. These files are marked with attribute 0x100 when I look at them. I have the following text from Microsoft: "
Using CreateFile () using the FILE_ATTRIBUTE_TEMPORARY flag, you let the system know that the file is likely to be short. a temporary file is created as a regular file. The system needs to perform the minimum number of lazy entries in the file system storage disk structures (directories, etc.). This gives the file was written to disk. "
Any example of creating such a temporary file using Delphi?
Thanks.
[EDIT]
An additional question: what can be the context of using such a file, for example, can it be used for a log system. is the log file with the temp attribute? Would it be faster and less memory when the log becomes very large?
[EDIT]
Ok, I created the file using the solution indicated by schnaader below with the FILE_ATTRIBUTE_TEMPORARY file:
hMyFile := CreateFile(FileName, GENERIC_WRITE, 0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, 0);
Such a file receives the 0x120 attribute upon creation. Thus, a temporary file in accordance with the system.
I also create a file with the flag FILE_FLAG_DELETE_ON_CLOSE ( see this article by L. Osterman ).
So:
hMyFile := CreateFile(FileName, GENERIC_WRITE, 0, nil, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0);
This file does not receive an attribute, and the file is automatically deleted when the application is closed or destroyed.
I did not find how to combine attribute and flag . Any ideas?
thanks