## GUnixOutputStream GUnixOutputStream — Streaming output operations for UNIX file descriptors |

## Functions

GOutputStream * | g_unix_output_stream_new ()
void | g_unix_output_stream_set_close_fd ()
gboolean | g_unix_output_stream_get_close_fd ()
gint | g_unix_output_stream_get_fd ()

## Properties

gboolean | close-fd | Read / Write
gint | fd | Read / Write / Construct Only

## Types and Values

struct | GUnixOutputStream

## Object Hierarchy

        GObject
        ╰── GOutputStream
            ╰── GUnixOutputStream

## Implemented Interfaces

GUnixOutputStream implements GPollableOutputStream and GFileDescriptorBased.

## Includes

    #include <gio/gunixoutputstream.h>

## Description

GUnixOutputStream implements GOutputStream for writing to a UNIX file descriptor, including asynchronous operations. (If the file descriptor refers to a socket or pipe, this will use `poll()` to do asynchronous I/O. If it refers to a regular file, it will fall back to doing asynchronous I/O in another thread.)

Note that `<gio/gunixoutputstream.h>` belongs to the UNIX-specific GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config file when using it.

## Functions

### g_unix_output_stream_new ()

    GOutputStream *
    g_unix_output_stream_new (gint fd,
                              gboolean close_fd);

Creates a new GUnixOutputStream for the given `fd` .

If `close_fd` , is `TRUE`, the file descriptor will be closed when the output stream is destroyed.

#### Parameters

fd | a UNIX file descriptor |
close_fd | `TRUE` to close the file descriptor when done |

#### Returns

a new GOutputStream

### g_unix_output_stream_set_close_fd ()

    void
    g_unix_output_stream_set_close_fd (GUnixOutputStream *stream,
                                       gboolean close_fd);

Sets whether the file descriptor of `stream` shall be closed when the stream is closed.

#### Parameters

stream | a GUnixOutputStream |
close_fd | `TRUE` to close the file descriptor when done |

Since: 2.20

### g_unix_output_stream_get_close_fd ()

    gboolean
    g_unix_output_stream_get_close_fd (GUnixOutputStream *stream);

Returns whether the file descriptor of `stream` will be closed when the stream is closed.

#### Parameters

stream | a GUnixOutputStream |

#### Returns

`TRUE` if the file descriptor is closed when done

Since: 2.20

### g_unix_output_stream_get_fd ()

    gint
    g_unix_output_stream_get_fd (GUnixOutputStream *stream);

Return the UNIX file descriptor that the stream writes to.

#### Parameters

stream | a GUnixOutputStream |

#### Returns

The file descriptor of `stream`

Since: 2.20

## Types and Values

### struct GUnixOutputStream

    struct GUnixOutputStream;

Implements GOutputStream for outputting to selectable unix file descriptors

## Property Details

### The `“close-fd”` property

      “close-fd”                 gboolean

Whether to close the file descriptor when the stream is closed.

Flags: Read / Write

Default value: TRUE

Since: 2.20

### The `“fd”` property

      “fd”                       gint

The file descriptor that the stream writes to.

Flags: Read / Write / Construct Only

Default value: -1

Since: 2.20

## See Also

GOutputStream