如何从流中将错误消息的文本转换为变量?获取错误消息
例如
void * thread_func(void) {
char args[]={"firefox","ax",NULL};
pid_t child_pid = fork();
if(child_pid!=0) {
cout<<"error";
} else {
execvp("firefox",args); /*something should be done here to get the message*/
}
return 0;
}
什么错误?什么信息?什么流?什么变量? – ereOn 2011-03-19 13:03:16
请发布代码,你必须显示你想要的是什么。 – Mat 2011-03-19 13:03:33
例如void * thread_func(void) {char _ args [] = {“firefox”,“ax”,NULL}; pid_t child_pid = fork(); (child_pid!= 0) if(child_pid!= 0) cout <<“error”;其他 execvp(“firefox”,args); /*这里应该做些什么来获得消息*/ } return 0; } – Hayk 2011-03-19 13:21:16