7. Value parsing callback
Prev |  | Next

## 7. Value parsing callback

A value parsing callback is another kind of callback function available in libConfuse. This function is used to map a string into some other value. One example is to extend a boolean option to accept the values "yes", "no" and "ask" (or perhaps "true", "false" and "maybe"). Those values should be mapped to the integers 1, 2 and 3.

    typedef int (*cfg_callback_t)(cfg_t *cfg, cfg_opt_t *opt,
                                  const char *value, void *result);

Prev |  | Next
6. Validating callback functions | Home | 8. Functions