Function

GLibascii_strtoll

Declaration [src]

gint64
g_ascii_strtoll (
  const gchar* nptr,
  gchar** endptr,
  guint base
)

Description [src]

Converts a string to a #gint64 value. This function behaves like the standard strtoll() function does in the C locale. It does this without actually changing the current locale, since that would not be thread-safe.

This function is typically used when reading configuration files or other non-user input that should be locale independent. To handle input from the user you should normally use the locale-sensitive system strtoll() function.

If the correct value would cause overflow, G_MAXINT64 or G_MININT64 is returned, and ERANGE is stored in errno. If the base is outside the valid range, zero is returned, and EINVAL is stored in errno. If the string conversion fails, zero is returned, and endptr returns nptr (if endptr is non-NULL).

Available since:2.12

Parameters

nptr const gchar*
 

The string to convert to a numeric value.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
endptr gchar**
 

If non-NULL, it returns the character after the last character used in the conversion.

 The argument will be set by the function.
 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
base guint
 

To be used for the conversion, 2..36 or 0

Return value

Returns: gint64
 

The #gint64 value or zero on error.