-
Notifications
You must be signed in to change notification settings - Fork 10
chl_next_argf
it4e edited this page Apr 17, 2016
·
2 revisions
<chl/chl.h>
chl_next_argf, CHL next argument float
float chl_next_argf(char * args);
The chl_next_argf function is used to get the next argument converted to a float associated with the calling CHL function.
- args: on first call, the char * args variable passed to the calling CHL function. Then on further calls, NULL.
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.
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