Read CMD-Output

Hey,

I want to send data from one pc to another one using sockets. But that'a not
the Problem ;) I also want to use featurs like reading out things on the client side by using cmd,so that I dont't have to program whats already there. Such as time, ip and things like that.
So the problem is that the output of cmd only happens on the client side.

----------------
What I want (The command is for example "dir"):

[server]: sends the command "X" to the client
[client]: executes "dir" using cmd
[client]: returns the whole output of the cmd window to [server] (char buffer)
----------------

All works fine with my sockets. I just don't know if there is any way to
"capture" or redirect the output to the char-buffer...

ANproCUBE
Did you not use google?

http://stackoverflow.com/questions/796476/displaying-windows-command-prompt-output-and-redirecting-it-to-a-file

Then you open the file into your char* buffer and send that out.

Hope that helps.
Hey,

Indeed, I tried using google but i didn't find anything :(

Anyways, your answer helped me a lot, thanks :D

ANproCUBE
Last edited on
If you use google and don't get what you need, you are asking the wrong question. Keep that in mind =]

Glad to help, now, switch to linux.
That's a bad way to solve the problem.
Use pipes instead - it won't be a 100% portable solution, but it's the best way to work it out.
Topic archived. No new replies allowed.