### Function

# Gio pollable_stream_write_all

since: 2.34

#### Declaration [src]

    gboolean
    g_pollable_stream_write_all (
      GOutputStream* stream,
      void* buffer,
      gsize count,
      gboolean blocking,
      gsize* bytes_written,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Tries to write `count` bytes to `stream`, as with g_output_stream_write_all(), but using `g_pollable_stream_write()` rather than g_output_stream_write().

On a successful write of `count` bytes, `TRUE` is returned, and `bytes_written` is set to `count`.

If there is an error during the operation (including `G_IO_ERROR_WOULD_BLOCK` in the non-blocking case), `FALSE` is returned and `error` is set to indicate the error status, `bytes_written` is updated to contain the number of bytes written into the stream before the error occurred.

As with g_pollable_stream_write(), if `blocking` is `FALSE`, then `stream` must be a `GPollableOutputStream` for which `g_pollable_output_stream_can_poll()` returns `TRUE` or else the behavior is undefined. If `blocking` is `TRUE`, then `stream` does not need to be a `GPollableOutputStream`.

Available since: 2.34

#### Parameters

`stream`

  Type: `GOutputStream`

  A `GOutputStream`.

  The data is owned by the caller of the function.

`buffer`

  Type: An array of `guint8`

  The buffer containing the data to write.

  The length of the array is specified in the `count` argument.
  The data is owned by the caller of the function.

`count`

  Type: `gsize`

  The number of bytes to write.

`blocking`

  Type: `gboolean`

  Whether to do blocking I/O.

`bytes_written`

  Type: `gsize*`

  Location to store the number of bytes that was written to the stream.

  The argument will be set by the function.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

  The argument can be `NULL`.
  The data is owned by the caller of 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 function 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: `gboolean`

`TRUE` on success, `FALSE` if there was an error.