From owner-freebsd-questions Sun Jul 8 3:59:31 2001 Delivered-To: freebsd-questions@freebsd.org Received: from beta.root-servers.ch (gamma.root-servers.ch [195.49.62.126]) by hub.freebsd.org (Postfix) with SMTP id D9E0537B406 for ; Sun, 8 Jul 2001 03:59:22 -0700 (PDT) (envelope-from gabriel_ambuehl@buz.ch) Received: (qmail 59208 invoked from network); 8 Jul 2001 10:59:21 -0000 Received: from dclient106-17.hispeed.ch (HELO athlon550) (62.2.106.17) by beta.root-servers.ch with SMTP; 8 Jul 2001 10:59:21 -0000 Date: Sun, 8 Jul 2001 13:00:14 +0200 From: Gabriel Ambuehl X-Mailer: The Bat! (v1.53bis) Educational Organization: BUZ Internet Services X-Priority: 3 (Normal) Message-ID: <114577608557.20010708130014@buz.ch> To: freebsd-questions@freebsd.org Subject: Passing data in C++ via stdin without waiting for the new process to complete MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hello, I wonder how I could efficiently achieve to pass data via stdin to a new process spawned by the current one without having the parent process waiting for the child to complete. I just want to spawn the child, pass the data to it and then forget about it, no matter how long it takes for the child to complete. popen() doesn't appear to be a suitable tool for this kind of work as the manpage says: The pclose() function waits for the associated process to terminate and returns the exit status of the command as returned by wait4(). which means that the parent is blocked til the client finishes. system("echo data | some_app"); does work, but the parent process still is blocked till the child finishes and I don't think it's the most efficient of all ideas to first spawn a shell (although popen() appears to be doing this as well), then spawn an instance of echo just to get the data where it should be and then spawn the third process to do the actual work. Any comments would greatly be appreciated. TIA & best regards, Gabriel  -----BEGIN PGP SIGNATURE----- Version: PGP 6.5i iQEVAwUBO0gvNMZa2WpymlDxAQGQ2QgAu3XWwCawKeL8UcozL15BthwMIN3Ousow mL3AQpQUDrV3areksXaQLnGwjTVUZMZf+wSruYKXubwcl3uTI5RmH38QvoDrD9OU 045BJhSsu0AxsX8oNGTm/Ch9vr9onJzJF3Ur5AdzwG2FQJ8pH2HkFF3sBJw1HklY p7+WpJgBIF3g4aFyTKoAe/qJihsBgIiPDoWbXRG8lISf84YBcmUOecE0NAHjPMjB OjF3O+YFKys+JLHBrVwMGnNxKPzEmMFLZrZbdaW0PFpQMXEn+oxaTHfgDMhCdIyo BcH0nAxBnXZRX2jzXExs/ITVNsOatuaFRN6XT2QR9tt304dqKm/tLw== =qE6e -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message