How to capture the result of winexec()

C

Camel

Hi All,

I am doing my Visual C++ homework. My program requires to build a GUI and
ping a host, then display the result. I called winexec("ping 192.168.0.1"),
however it executed in DOS window. How can I capture the ping result?

Thanks in advance.
 
P

Phlip

Camel said:
I am doing my Visual C++ homework. My program requires to build a GUI and
ping a host, then display the result. I called winexec("ping 192.168.0.1"),
however it executed in DOS window. How can I capture the ping result?

popen("ping...");

You will get better results in a VC++ newsgroup; raw C++ specifies
incomplete libraries (compared to, say, Java), so all things to do with
pinging and pipes refer to the libraries that come with your compiler.
 
P

Phlip

Abecedarian said:
http://msdn.microsoft.com/library/d..._process_with_redirected_input_and_output.asp

I keep trying that, and it keeps kicking my ass.

To the OP: Use as many POSIX-style things as possible. If a popen or _popen
is available, use it in preference to mucking with raw Win32 file HANDLE
types. popen exists to solve some of the problems that low level stuff
causes.

Use either popen or system("ping ... >yo.txt"). Then read the contents of
yo.txt. I'm not kidding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,522
Members
48,229
Latest member
Chelsea806

Latest Threads

Top