473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to capture the result of winexec()

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.
Jul 23 '05 #1
3 5784
Camel wrote:

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.

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Jul 23 '05 #2
Phlip wrote:
Camel wrote:

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...");
or read:
http://msdn.microsoft.com/library/de...and_output.asp
You will get better results in a VC++ newsgroup;


e.g.:
http://www.codeproject.com/script/co...p?forumid=1647

::A::

Jul 23 '05 #3
Abecedarian wrote:
or read:
http://msdn.microsoft.com/library/de...and_output.asp

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


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.

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: xc | last post by:
Greetings. I encountered a wield problem when grabing screen images. Sometimes in some computers I can capture the screen, but other times not so. In some computer I cannot capture the screen...
3
by: Chris LaJoie | last post by:
I'm looking for the framework equivilent of either the ShellExec or WinExec API. Preferably ShellExec because I can use it to launch the default browser as well as launch executables. thanks.
1
by: Daniel Bass | last post by:
in VC++ you could go WinExec("C:\\myExe.exe", "open"); how do i do this in C#? can't find anything in MSDN... Thanks. =o) Dan.
2
by: CSharpX | last post by:
Hi can anyone tell me how to call an external application from withing C# code? I can't find WinExec anywhere? Do i have to go and look for the shell functionality for launching applicatoins from...
5
by: ewillyb | last post by:
Hi, ASP.NET has some interesting behavior when the user hits the Enter key. If there are multiple ASP:Buttons (rendered as HTML submits) on the form, when the user hits enter, the first button's...
4
by: jxiang | last post by:
I created a child form that is much bigger than the MDI form in VB.Net. I am trying to capture the whole child form and save as an image or sent to printer. I tried to use BitBlt to capture the...
2
by: Luc | last post by:
Hello, I've got following problem: I have two applications, the first one is running and reads the second one into memory. And I need to run the second application directly from the memory...
0
by: Baron Sydney von Harbour Bridge | last post by:
Regulatory Capture is when regulators do no more than the bidding of those they supposed to regulate. Victims of regulatory capture include Nick Hardwick and John Wadham of the Independent Police...
2
by: jdbartlett | last post by:
I'm trying to capture output from a command line utility (XMLSec), but only get an empty result. If I call the script from the command line, I see XMLSec's output, but I can't seem to capture it!...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.