[#BloombergLP-bdls-FdStreamBuf-2constructor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FdStreamBuf.adoc[FdStreamBuf]::FdStreamBuf
:relfileprefix: ../../../
:mrdocs:

Create a stream buffer associated with the specified file descriptor&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
FdStreamBuf(
    xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FilesystemUtil::FileDescriptor] fileDescriptor,
    bool writableFlag,
    bool willCloseOnResetFlag = true,
    bool binaryModeFlag = false,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

== Description

Create a `FdStreamBuf` associated with the specified `fileDescriptor` that refers to an already opened file or device, and specify `writableFlag` which, if `true`, indicates that `fileDescriptor` is writable, otherwise it is not&period; The optionally specified `willCloseOnResetFlag`, if `true`, indicates that `fileDescriptor` is to be closed the next time this object is reset, cleared or destroyed, or if `false` the file descriptor is to be left open&period; Optionally specify a `binaryModeFlag` which is ignored on Unix&semi; if `false` on Windows, it indicates that &grave;
&grave;s are to be translated to and from &grave;&bsol;r
` sequences on the device&period; Optionally specify a `basicAllocator&grave; used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; The supplied file descriptor, if valid, should remain open until the next call to either `reset` or the destructor&period; Note that if `FilesystemUtil&colon;&colon;k&lowbar;INVALID&lowbar;FD` is passed to `fileDescriptor`, no file descriptor is to be associated with this object&period; Also note that the state of the `fileDescriptor` is unchanged by this call (i&period;e&period;, there is no implicit seek)&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *fileDescriptor*
| already&hyphen;opened file or device descriptor
| *writableFlag*
| `true` if `fileDescriptor` is writable
| *willCloseOnResetFlag*
| whether to close the descriptor on reset
| *binaryModeFlag*
| `true` for binary mode&semi; ignored on Unix
| *basicAllocator*
| memory allocator&semi; null uses the default
|===


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