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

Name

<chl/chl.h>

chl_next_argf, CHL next argument float

Declaration

float chl_next_argf(char * args);

Description

The chl_next_argf function is used to get the next argument converted to a float 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 float value of argument, -1 if last argument is reached, if conversion to float could not be done or if an error occurred.


Examples

main.c

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

void print_float(char * args) {
    float arg;

    if((arg = chl_next_argf(args)) > 0)
        printf("%f", arg);
}

int main() {
    chl_func_append("print_float", print_float);
    chl_func("print_float", "1234.2441");
}

Output: 1234.2441

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