From owner-freebsd-questions@FreeBSD.ORG Tue Apr 14 18:13:00 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 637D01065B1E for ; Tue, 14 Apr 2009 18:13:00 +0000 (UTC) (envelope-from tobias.rehbein@web.de) Received: from fmmailgate03.web.de (fmmailgate03.web.de [217.72.192.234]) by mx1.freebsd.org (Postfix) with ESMTP id 694928FC4A for ; Tue, 14 Apr 2009 18:12:56 +0000 (UTC) (envelope-from tobias.rehbein@web.de) Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate03.web.de (Postfix) with ESMTP id 2CF85FA6EEF1 for ; Tue, 14 Apr 2009 20:12:55 +0200 (CEST) Received: from [95.88.233.54] (helo=sushi.pseudo.local) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1Ltn7u-0001rh-00 for freebsd-questions@freebsd.org; Tue, 14 Apr 2009 20:12:55 +0200 Received: from sushi.pseudo.local (localhost [127.0.0.1]) by sushi.pseudo.local (8.14.3/8.14.3) with ESMTP id n3EID0VB003887 for ; Tue, 14 Apr 2009 20:13:00 +0200 (CEST) (envelope-from tobi@sushi.pseudo.local) Received: (from tobi@localhost) by sushi.pseudo.local (8.14.3/8.14.3/Submit) id n3EID0RM003886 for freebsd-questions@freebsd.org; Tue, 14 Apr 2009 20:13:00 +0200 (CEST) (envelope-from tobi) Date: Tue, 14 Apr 2009 20:13:00 +0200 From: Tobias Rehbein To: freebsd-questions@freebsd.org Message-ID: <20090414181300.GA3813@sushi.pseudo.local> Mail-Followup-To: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Mutt/1.4.2.3i Sender: tobias.rehbein@web.de X-Sender: tobias.rehbein@web.de X-Provags-ID: V01U2FsdGVkX18Tm1M8NE0aahh4J+mfNAMlrv1Jn+KUEzgZocWC ttbjW+erQ3aAZcgq4fSFEQOy8OeLCtl67OCJQhRX1xRDcavXRn LS/p6x0IcXuFE4YDvbGA== Subject: [OT] C programming question: reopen stdin X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 18:13:28 -0000 Hi all. I'm having a little trouble solving a specific problem in C. I want to writ= e a filter which reads data from stdin. After reading the user should be able to interact with the program via stdin. This means I have to reopen stdin but I don't know how to do this. I tried to solve this using dup() and dup2() but without success. You can have a look at my first experiment here: http://gist.github.com/95320 I guess the code and the contained comments show what I'm trying to achieve. Although this is off-topic on this list I hope someone with more knowledge = in C may steer me into the right direction. Sorry for the noise and thanks for reading. Regards Tobias --=20 Tobias Rehbein PGP key: 4F2AE314 server: keys.gnupg.net fingerprint: ECDA F300 1B6E 9B87 8524 8663 E8B6 3138 4F2A E314