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


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 >> 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


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!


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


I'll explore handles and windows.h library