hmm .. MSDN has this as an example:
int main( void )
{
char psBuffer[128];
FILE *pPipe;
if( (pPipe = _popen( "dir *.c /on /p", "rt" )) == NULL )
exit( 1 );
while(fgets(psBuffer, 128, pPipe))
{
printf(psBuffer);
}
if (feof( pPipe))
{
printf( "\nProcess returned %d\n", _pclose( pPipe ) );
}
else
{
printf( "Error: Failed to read the pipe to the end.\n");
}
}
, . ++.