Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I would like to create a batch file that is able to send its output directly to and exe, which will handle the information.

For example: I ping google.com 100 times and want to parse each response with an exe file builded in c++.

It is important for me to do this real time, so it is not an option to read the full log file after pinging.

share|improve this question

1 Answer

up vote 1 down vote accepted

Use pipe.

ping google.com -c 100 | ./path/to/exe.exe

if you batch file contains ping google.com -c 100 you can just pipe the batch file itself

file.bat | ./path/to/exe.exe

Pipe will send the output to stdin of your exe file. So read it from STDIN. std::cin will do.

share|improve this answer
 
i tried this before, but how can I reach the data with c++? It is not in argv –  Iburidu Jun 12 at 9:30
 
Read from STDIN. Use std::cin. –  shiplu.mokadd.im Jun 12 at 9:33
 
thanks for the fast answer, it works :) –  Iburidu Jun 12 at 9:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.