popen output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



   
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

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux