Capturing Console Output of Program in C++ [duplicate]

  c++, console-output

I am running Cadical from a c++ program that I wrote using the standard system(./cadical fileName). Cadical will output to the console the solution it finds (just an array of numbers) and I am trying to find a way to capture this array and use it within the program without copy pasting the result into a file. Is there a way to automatically read this output?

Source: Windows Questions C++