[#BloombergLP-bdls-FilesystemUtil-createTemporaryFile-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::createTemporaryFile
:relfileprefix: ../../../
:mrdocs:

Create and open a new file with a name constructed by appending an automatically&hyphen;generated suffix to the specified `prefix`, and return its file descriptor open for reading and writing&period; A return value of `k&lowbar;INVALID&lowbar;FD` indicates that no such file could be created&semi; otherwise, the name of the file created is assigned to the specified `outPath`&period; The file is created with permissions restricted, as closely as possible, to the caller&grave;s userid only&period; If the prefix is a relative path, the file is created relative to the process current directory&period; Responsibility for deleting the file is left to the caller&period; Note that on Posix systems, if `outPath` is unlinked immediately, the file will remain usable until its descriptor is closed&period; Note that files created on Microsoft Windows may receive default, not restricted permissions&period;

== Synopsis

Declared in `&lt;bdls&lowbar;filesystemutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FileDescriptor]
createTemporaryFile(
    xref:bsl/string.adoc[bsl::string]* outPath,
    std::string&lowbar;view const& prefix);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
