Gio.OutputStream.printf

### Method

# Gio OutputStreamprintf

since: 2.40

#### Declaration [src]

    gboolean
    g_output_stream_printf (
      GOutputStream* stream,
      gsize* bytes_written,
      GCancellable* cancellable,
      GError** error,
      const gchar* format,
      ...
    )

#### Description [src]

This is a utility function around g_output_stream_write_all(). It uses `g_strdup_vprintf()` to turn `format` and @… into a string that is then written to `stream`.

See the documentation of `g_output_stream_write_all()` about the behavior of the actual write operation.

Note that partial writes cannot be properly checked with this function due to the variable length of the written string, if you need precise control over partial write failures, you need to create you own printf()-like wrapper around `g_output_stream_write()` or g_output_stream_write_all().

Available since: 2.40

This method is not directly available to language bindings.

#### Parameters

`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.
  The argument can be `NULL`.

`cancellable`

  Type: `GCancellable`

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

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError`

  Location to store the error occurring, or `NULL` to ignore.

  The data is owned by the caller of the method.

`format`

  Type: `const gchar*`

  The format string. See the `printf()` documentation.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  The parameters to insert into the format string.

#### Return value

Type: `gboolean`

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