c使用va_list打印参数列表
|
我有一个简单的参数列表。而且我只是想将其打印到标准输出,但是在打印“结束”之前我要获得有线输出。有谁知道空行和不可读字符来自何处?
输出:
start
hello
hello2
hello3
hello 4
UH��AWAVAUATE1�S1�H��HH�E�
end
void printTest(const char* msg, ...) {
va_list ap;
int i;
const char* curMsg=0;
va_start(ap, msg);
printf(\"start\\n\");
for(curMsg= msg ; curMsg!=0 ; curMsg = va_arg(ap, const char*)){
printf(\"%s\\n\", curMsg);
}
printf(\"end\\n\");
va_end(ap);
}
int main(){
printTest(\"hello\", \"hello2\", \"hello3\", \"hello 4\");
return 0;
}
没有找到相关结果
已邀请:
2 个回复
糖固傻染
窝头菊