-
Notifications
You must be signed in to change notification settings - Fork 10
chl_next_argi
it4e edited this page Apr 17, 2016
·
2 revisions
<chl/chl.h>
chl_next_argi, CHL next argument integer
int chl_next_argi(char * args);
The chl_next_argi function is used to get the next argument converted to an integer 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 integer value of argument, -1 if last argument is reached, if conversion to integer could not be done or if an error occurred.
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