### Method

# Gio BufferedInputStream read_byte

#### Declaration [src]

    int
    g_buffered_input_stream_read_byte (
      GBufferedInputStream* stream,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Tries to read a single byte from the stream or the buffer. Will block during this read.

On success, the byte read from the stream is returned. On end of stream `-1` is returned but it’s not an exceptional error and `error` is not set.

If `cancellable` is not `NULL`, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error `GIOErrorEnum` will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.

On error `-1` is returned and `error` is set accordingly.

#### Parameters

`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 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: `int`

The byte read from the `stream`, or `-1` on end of stream or error.