On 1/26/07, Dan Mick <[EMAIL PROTECTED]> wrote:
Ritesh wrote:
> thanks ian and dmick.
>
> so, if i have a following line in my code:
> pclose(popen("/tmp/somescript","w"));
That's nonsensical. Don't do that.
That is exactly what example 2 in popen(3C) does, except for the error checking:
The following function can be used in a multithreaded pro-
cess in place of the most common usage of the Unsafe
system(3C) function:
int my_system(const char *cmd)
{
FILE *p;
if ((p = popen(cmd, "w")) == NULL)
return (-1);
return (pclose(p));
}
--
Eric Enright
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code