GLib.IOChannel.write_chars

### Method

# GLib IOChannelwrite_chars

#### Declaration [src]

    GIOStatus
    g_io_channel_write_chars (
      GIOChannel* channel,
      const gchar* buf,
      gssize count,
      gsize* bytes_written,
      GError** error
    )

#### Description [src]

Replacement for `g_io_channel_write()` with the new API.

On seekable channels with encodings other than `NULL` or UTF-8, generic mixing of reading and writing is not allowed. A call to g_io_channel_write_chars () may only be made on a channel from which data has been read in the cases described in the documentation for g_io_channel_set_encoding ().

#### Parameters

`buf`

  Type: An array of `guint8`

  A buffer to write data from.

  The data is owned by the caller of the method.

`count`

  Type: `gssize`

  The size of the buffer. If -1, the buffer is taken to be a nul-terminated string.

`bytes_written`

  Type: `gsize*`

  The number of bytes written. This can be nonzero even if the return value is not `G_IO_STATUS_NORMAL`. If the return value is `G_IO_STATUS_NORMAL` and the channel is blocking, this will always be equal to `count` if `count` >= 0.

  The argument will be set by the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GIOStatus`

The status of the operation.