c++ system commands | Sololearn: Learn to code for FREE!

+3

c++ system commands

Hello All, What is the way to posses data made by system() function in C++ to program's variable and process it next? Is it only possible to prepare system's function direct to file and then read from the file? For example:: system( "ping 192.168.1.1 >> file.txt"); then read from file... Can I omit creating temporary file? Thanks in advance!

2/21/2018 3:55:28 PM

Łukasz Szczyglewski

3 Answers

New Answer

+1

This link is probably applicable: https://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c-using-posix Hope this helps!

0

As far as not creating a temporary file you could use a macro.

0

I'll explore handles and windows.h library