[#BloombergLP-bdls-FilesystemUtil-open-0f]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::open
:relfileprefix: ../../../
:mrdocs:

Open the file at the specified `path` according to the given policies&period;

== Synopses

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

Open the file at the specified `path` according to the given policies&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FileDescriptor]
xref:BloombergLP/bdls/FilesystemUtil/open-01.adoc[open](
    char const* path,
    xref:BloombergLP/bdls/FilesystemUtil/FileOpenPolicy.adoc[FileOpenPolicy] openPolicy,
    xref:BloombergLP/bdls/FilesystemUtil/FileIOPolicy.adoc[FileIOPolicy] ioPolicy,
    xref:BloombergLP/bdls/FilesystemUtil/FileTruncatePolicy.adoc[FileTruncatePolicy] truncatePolicy = e&lowbar;KEEP);
----

[.small]#xref:BloombergLP/bdls/FilesystemUtil/open-01.adoc[_» more&period;&period;&period;_]#

Open the file at the specified `path` according to the given policies&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class STRING&lowbar;TYPE&gt;
static
xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FilesystemUtil::FileDescriptor]
xref:BloombergLP/bdls/FilesystemUtil/open-0a.adoc[open](
    STRING&lowbar;TYPE const& path,
    xref:BloombergLP/bdls/FilesystemUtil/FileOpenPolicy.adoc[FileOpenPolicy] openPolicy,
    xref:BloombergLP/bdls/FilesystemUtil/FileIOPolicy.adoc[FileIOPolicy] ioPolicy,
    xref:BloombergLP/bdls/FilesystemUtil/FileTruncatePolicy.adoc[FileTruncatePolicy] truncatePolicy = e&lowbar;KEEP);
----

[.small]#xref:BloombergLP/bdls/FilesystemUtil/open-0a.adoc[_» more&period;&period;&period;_]#

== Return Value

a valid `FileDescriptor` on success, or `k&lowbar;INVALID&lowbar;FD` otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *path*
| filesystem path of the file to open
| *openPolicy*
| whether to open an existing file or create a new one
| *ioPolicy*
| whether the file is opened for reading, writing, or both
| *truncatePolicy*
| whether to delete existing contents on open
|===


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