[英]Using fnmatch with a char Pointer
The array options
contains elements of this form: "-option=value". 数组
options
包含以下形式的元素:“-option = value”。
The argument needed_option
contains for example "option" 参数
needed_option
包含例如“ option”
char *function(char *options[], char *needed_option){
for(//go over all possible options){
if(fnmatch("-???=*", options[i], 0) == 0){ //<--- look here
char *ret = extract_value_from_option();
return ret;
}
}
}
Question: Is there a way to genericly replace the " ???
" with the function - argument needed_option
like its done in printf()
where a char *
can be included by using the %s
? 问题:有没有一种方法可以像
needed_option
在printf()
中那样用function-argument_option参数替换“ ???
”,其中可以使用%s
包含char *
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.