-
Notifications
You must be signed in to change notification settings - Fork 10
chl_get_args
it4e edited this page Mar 21, 2016
·
4 revisions
<chl/chl.h>
chl_get_args, CHL get arguments
char chl_get_args(char *(** arguments), char * args);
The chl_get_args function is used to get the arguments [arguments] associated with the calling CHL function.
- arguments: the address of a ** char variable. This is where the arguments will be put. Dynamically allocated.
- args: the char * args variable passed to the calling CHL function.
On success: the number of arguments found, 0 if no arguments could be found.
main.c
#include <chl/chl.h>
#include <stdio.h>
void print(char * args) {
char ** arguments;
chl_get_args(&arguments, args);
fputs(arguments[0], stdout);
fputs(arguments[1], stdout);
}
int main() {
chl_func_append("print", print);
chl_func("print", "'Hello', 'world'");
}
Output: Helloworld