You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dabaichi edited this page Oct 19, 2013
·
3 revisions
Here is an example for how to use the cmdline source code!
You can compile it as an share object(.so) on *nix or dynamic load library on Windows(.dll).
Then compile your program with the .so or .dll file depend on your system.
The easy way is add the cmdline.c and cmdline.h to your program.
In you main function you can use the API directly!
int main(int argc, char * argv[])
{
cmdline.init(argc, argv);
//If you want to know whether -f is passed to your program
if(cmdline.exist("-f")){
//do what you want to do when -f is passed
} else {
//do what you want to do when -f is not passed
}
//If -t parameter is with a value
char * value = cmdline.getvalue("-t");
if(value){
//do what you want to do with the -t parameter's value
} else {
//If value is points to NULL, maybe the -t is not passed or -t is without a value
}
}