VasquezPL 0 Junior Poster

I have a question. I worte frontend application to manage Active Directory.
It uses AD commands like "dsquery,dsget etc"
I use them this way: system ("dsquery *");
What i need to do is to write a code that will capture all text viewed by commands in system("") or to capture all visible text in console window.

for example:
dsquery command will generate error -> i need to capture it to txt file (for example log.txt)..Is it possible to do?