Like in the title, i need a function which will run a specific program (In this case its a console) and i will be able to store its output in a variable. I'm looking for function like exec in PHP.
@edit: I have searched google for about 2 hours, and everything didn't work or was only for linux.
If so, and you're using Visual Studio, the function Athar mentioned has acquired an underscore prefix: _popen
store its output in a variable.
What kind of variable do you mean?
_popen returns a stream (FILE*) -- associated with one end of a pipe -- which allows you to capture the progam's output. It's up to you to process this output so it can be stored in one or more variables.
(On Windows, you can do the same kind of thing with CreateProcess and CreatePipe, but it is rather more involved)
yes im Using Visual Studio and Windows. I was using popen and it didnt work, Looks like _popen is working, can u give me any documention regarding this function?