Static int output_fa_and_child (struct tree * fa)
{
Printf (" process PID: % d \ t process name: % ws \ n ", the fa - & gt; Elem. ProcessID, fa - & gt; Elem. ProcessName. C_str ());
Struct tree * vy=fa - & gt; FirstChild;
While (vy) {
Output_fa_and_child (vy);//recursive call
Vy=vy - & gt; NextBro;
}
return 0;
}
This string of code, basically can output process, but there are some process can not output process name, even the back of the newline character also doesn't work, would like to ask what is the great god,
CodePudding user response:
Don't process name is normal,When input and output of the first test, or pointing to an unsigned short t [10]=x0fff {0}; Such random space can produce such a situation,
CodePudding user response:
Is probably the process name contains Chinese, Chinese GBK code in Chinese Windows console is displayed properly, if it is in Chinese wide string (Unicode), is part of a display in Chinese will be a problem, see https://blog.csdn.net/binaryhead/article/details/109993588CodePudding user response:
Want to see your tree in previous deal with what kind ofCodePudding user response:
static int output_fa_and_child (struct tree * fa)
{
Printf (" \ xe8 \ XBF \ x9b \ xe7 \ xa8 \ x8bPID: % d \ \ t xe8 \ XBF \ x9b \ xe7 \ xa8 \ x8b \ xe5 \ x90 \ x8d: % s \ n ", the fa - & gt; Elem. ProcessID, fa - & gt; Elem. ProcessName. C_str ());
Struct tree * vy=fa - & gt; FirstChild;
While (vy) {
Output_fa_and_child (vy);
Vy=vy - & gt; NextBro;
}
return 0;
}
CodePudding user response:
For computer no noise, only the binary bytes; To the human brain is gibberish, GBK: 0 xb0 0 xa1, Unicode - 16 LE: 0 x4a 0 x55, Unicode - 16 BE: 0 x55 0 x4a, utf-8 8-0 x95 xE5 0 0 x8aCodePudding user response: