On reflection I guess this is probably related to all your other questions on this subject. A pity you showed that random code in your question that has nothing to do with it, rather than the actual code you are using. As I have suggested more than once including at
How do I redirect "system" call output ?[
^], you need to use the
popen
method to read the output of a shelled process. If you want to capture both the normal and error streams, then you need to redirect
stderr
to
stdout
in your shell command thus:
hcitool info 98:D3:31:F8:39:33 2>&1
The expression
2>&1
tells the shell to redirect stream number 2 (
stderr
) to stream number 1 (
stdout
), so that all output ends up in the same place: either terminal or redirected again to a file. It is up to you, the user, to separate the messages in the combined output.
The redirection of streams is fully explained in the bash man pages, which I again suggest you read.