Skip to content
it4e edited this page Apr 17, 2016 · 2 revisions

Name

<chl/chl.h>

chl_next_argi, CHL next argument integer

Declaration

int chl_next_argi(char * args);

Description

The chl_next_argi function is used to get the next argument converted to an integer associated with the calling CHL function.

Arguments

  • args: on first call, the char * args variable passed to the calling CHL function. Then on further calls, NULL.

Return value

The converted integer value of argument, -1 if last argument is reached, if conversion to integer could not be done or if an error occurred.


Examples

main.c

#include <chl/chl.h>
#include <stdio.h>

void print_int(char * args) {
    int arg;

    if((arg = chl_next_argi(args)) > 0)
        printf("%d", arg);
}

int main() {
    chl_func_append("print_int", print_int);
    chl_func("print_int", "1234");
}

Output: 1234

As CHL is open-source, people are able to contribute with their own APIs, plugins and code which means that CHL is constantly upgraded and provided with new features. Do you have an idea for a new CHL feature and want to contribute?

See contribute.

Setup. API. Tutorial. Examples. FastCGI.

Clone this wiki locally