I have to run a system command in a my C++ code:
int val = system( "pacmd list-sink-inputs | grep -c 'state: RUNNING'" );
The command returns the result to val which is desirable, but also val or the return of the call( I can't seem to figure out which one ) also gets written to stdout and prints on the terminal.
Is there a way to redirect the call to NOT write to stdout or anywhere but to val?