Name: Anonymous 2011-06-24 5:46
switch(fd)
{
case 0:
f = freopen(_PATH_DEVNULL, r, stdin);
break;
case 1:
f = freopen(_PATH_DEVNULL, w, stdout);
break;
case 2:
f = freopen(_PATH_DEVNULL, w, stderr);
break;
default:
f = NULL;
break;
}
f = (fd == 0) ? freopen(_PATH_DEVNULL, r, stdin)
: (fd == 1) ? freopen(_PATH_DEVNULL, w, stdout)
: (fd == 2) ? freopen(_PATH_DEVNULL, w, stderr)
: NULL;