Date: Mon, 22 Oct 2001 03:02:33 -0400 (EDT) From: Joe Clarke <marcus@marcuscom.com> To: Matthew Blacklow <matthew.blacklow@ticca.com> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: C clue on FreeBSD Message-ID: <20011022030129.C11121-100000@shumai.marcuscom.com> In-Reply-To: <20011022025459.X11121-100000@shumai.marcuscom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 22 Oct 2001, Joe Clarke wrote: > > > On Mon, 22 Oct 2001, Matthew Blacklow wrote: > > > Hi all, > > I am running FreeBSD and am trying to learn C. I have a program at the > > moment which using C's "system" function launches a FreeBSD application. The > > problem is that it outputs to the screen all the output of the spawned > > process. I need to know how to supress the output of this process. I have > > looked through many C programming books and on the web and cant seem to find > > what i am looking for. > > Try: > > system("/my/app 2>&1 >/dev/null"); Sorry, I should have said: system("/my/app >/dev/null 2>&1"); For some reason (there may be a good one, though I don't know what it is), the shell doesn't redirect stderr in the first example. Joe > > That will redirect all stdout and stderr to /dev/null, thus making your > program silent. > > Joe > > > > > All help appreciated > > > > > > Thanks, > > Matthew > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-questions" in the body of the message > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011022030129.C11121-100000>