Qmi.message_tlv_read_string
Description: Reference for Qmi.message_tlv_read_string

### Function

# Qmimessage_tlv_read_string

since: 1.12

#### Declaration [src]

    gboolean
    qmi_message_tlv_read_string (
      QmiMessage* self,
      gsize tlv_offset,
      gsize* offset,
      guint8 n_size_prefix_bytes,
      guint16 max_size,
      gchar** out,
      GError** error
    )

#### Description [src]

Reads a string from the TLV.

`offset` needs to point to a valid `gsize` specifying the index to start reading from within the TLV value (0 for the first item). If the variable is successfully read, `offset` will be updated to point past the read item.

Since 1.24.6 the read string is guaranteed to be valid UTF-8. Also, in order to overcome known firmware errors on string fields, this method will also attempt to parse the string as GSM-7 or UCS-2 if the initial UTF-8 validation fails.

Available since: 1.12

#### Parameters

`self`

  Type: `QmiMessage`

  A `QmiMessage`.

  The data is owned by the caller of the function.

`tlv_offset`

  Type: `gsize`

  Offset that was returned by qmi_message_tlv_read_init().

`offset`

  Type: `gsize*`

  Address of a the offset within the TLV value.

  The argument will be modified by the function.

`n_size_prefix_bytes`

  Type: `guint8`

  Number of bytes used in the size prefix.

`max_size`

  Type: `guint16`

  Maximum number of bytes to read, or 0 to read all available bytes.

`out`

  Type: `gchar**`

  Return location for the read string. The returned value should be freed with g_free().

  The argument will be set by the function.
  The caller of the function takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`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` if the variable is successfully read, otherwise `FALSE` is returned and `error` is set.