### Method

# GLib IOChannel set_buffered

#### Declaration

    void
    g_io_channel_set_buffered (
      GIOChannel* channel,
      gboolean buffered
    )

#### Description

The buffering state can only be set if the channel’s encoding is `NULL`. For any other encoding, the channel must be buffered.

A buffered channel can only be set unbuffered if the channel’s internal buffers have been flushed. Newly created channels or channels which have returned `G_IO_STATUS_EOF` not require such a flush. For write-only channels, a call to g_io_channel_flush () is sufficient. For all other channels, the buffers may be flushed by a call to g_io_channel_seek_position (). This includes the possibility of seeking with seek type `G_SEEK_CUR` and an offset of zero. Note that this means that socket-based channels cannot be set unbuffered once they have had data read from them.

On unbuffered channels, it is safe to mix read and write calls from the new and old APIs, if this is necessary for maintaining old code.

The default state of the channel is buffered.

#### Parameters

`buffered`

  Type: `gboolean`

  Whether to set the channel buffered or unbuffered.