From owner-freebsd-questions Thu Sep 14 17:47:49 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id 042E237B423 for ; Thu, 14 Sep 2000 17:47:47 -0700 (PDT) Received: from opal (cs.binghamton.edu [128.226.123.101]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with ESMTP id UAA16871; Thu, 14 Sep 2000 20:47:30 -0400 (EDT) Date: Thu, 14 Sep 2000 20:47:21 -0400 (EDT) From: Zhiui Zhang X-Sender: zzhang@opal To: Mike Meyer Cc: questions@freebsd.org Subject: Re: write to terminal in a background process In-Reply-To: <14785.27988.529047.912155@guru.mired.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 14 Sep 2000, Mike Meyer wrote: > Zhiui Zhang writes: > > I thought a background process can not write to terminal. It will get a > > signal if trying to do so. But someone presents me a small program: > > No, it *may* not be able to write to the terminal, depending on the > terminals modes. See "man stty", particularly the "tostop" option. > > > #include > > main() > > { > > printf("printing\n"); > > } > > > > $ a.out & > > > > and it does print. Can anyone explain this to me? Thanks. > > Try > $ stty tostop > $ a.out & > > and see what it does (or maybe it's "stty -tostop"). You are right! I just tested it and it worked. May I ask you another question? If several foreground processes reading from the stdin, will the keyboard inputs be accepted by them in a round-robin fashion? Thanks. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message