## 7.6 Conversion

The following functions are used to convert from Oz values to C data structures and vice versa.

`OZ_atom`

  > `OZ_Term OZ_atom(char *s)`

  Converts C string `s` to an Oz atom.

`OZ_atomToC`

  > `char *OZ_atomToC(OZ_Term t)`

  Converts Oz atom `t` to a C string.

`OZ_int`

  > `OZ_Term OZ_int(int i)`

  Converts C integer `i` to an Oz integer.

`OZ_intToC`

  > `int OZ_intToC(OZ_Term t)`

  Converts Oz integer `t` to a C integer. If the Oz integer doesn't fit into the C integer, the maximal resp. minimal C integer values are used.

`OZ_parseInt`

  > `char *OZ_parseInt(char *s)`

  Parse `s` as an Oz integer. Returns a pointer to the next character after the integer or null if `s` does not start with an integer in Oz syntax (see ``The Oz Notation'').

`OZ_CStringToInt`

  > `OZ_Term OZ_CStringToInt(char *s)`

  Converts C string `s` to an Oz integer. `s` must be a valid integer in Oz syntax (see ``The Oz Notation'').

`OZ_floatToC`

  > `double OZ_floatToC(OZ_Term t)`

  Converts Oz float `t` to a C float.

`OZ_float`

  > `OZ_Term OZ_float(double f)`

  Converts C float `f` to an Oz float.

`OZ_boolToC`

  > `int OZ_boolToC(OZ_Term t)`

  Returns non-zero iff `t` is equal to `true`.

`OZ_parseFloat`

  > `char *OZ_parseFloat(char *s)`

  Parse `s` as an Oz float. Returns a pointer to the next character after the float or null if `s` is not an float in Oz syntax (see ``The Oz Notation'').

`OZ_CStringToFloat`

  > `OZ_Term OZ_CStringToFloat(char *s)`

  Converts C string `s` to an Oz float. `s` must be a valid float in Oz syntax (see ``The Oz Notation'').

`OZ_CStringToNumber`

  > `OZ_Term OZ_CStringToNumber(char *s)`

  Converts C string `s` to an Oz number. `s` must be a valid integer or float in Oz syntax (see ``The Oz Notation'').

`OZ_toC`

  > `char *OZ_toC(OZ_Term t, int depth, int width)`

  Converts any Oz term `t` to an C string. This functions doesn't check for cycles. A `depth` of n means that trees are printed to a depth limit of n only, deeper subtrees are abbreviated by ,,,. A `width` of n means that for lists at most n elements and for records at most n fields are printed, the unprinted elements and fields are printed by ,,,.

`OZ_string`

  > `OZ_Term OZ_string(char *s)`

  Converts C string `s` to an Oz string.

`OZ_stringToC`

  > `char *OZ_stringToC(OZ_Term t, int *n)`

  Converts Oz string `t` to a C string and returns in `n` the length of string.

`OZ_virtualStringToC`

  > `char *OZ_virtualStringToC(OZ_Term t, int *n)`

  Converts Oz virtual string `t` to a C string. The returned value is overridden with the next invocation of this function.