popen output
Muhammad Rizwan
rizwan at nixpanel.com
Thu Mar 10 13:07:55 UTC 2005
Hello
Is it possible to read the results of popen from stdout i.e. console
through c program. I am using the follwoing program, and its showing the
result of command on console, but this output is not readable by
program.
fp = popen("useradd testing", "r");
while( fp != NULL )
{
memset(Buffer, '\0', sizeof(Buffer));
CharRead = fread(Buffer, sizeof(char), 1023, fp);
if( CharRead > 0 )
{
cout <<"Buffer: "<<Buffer<<endl;
}
else
break;
}
Any idea?
Thanks
More information about the redhat-list
mailing list