From: Topher Fischer <javert42@cs.byu.edu>
To: linux-c-programming@vger.kernel.org
Subject: Getting output from another program.
Date: Wed, 21 Mar 2007 14:01:14 -0600 [thread overview]
Message-ID: <46018F0A.9010801@cs.byu.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
Today I discovered the 'file' command. I was immediately embarrassed
and upset that I have gone so long without ever running into it. It
also made me think of a few questions.
1. Is there a C library that provides equivalent or similar
functionality (especially for identifying MIME types)?
2. What's the best practice for getting output from an external command?
I've heard of it being done by forking, overwriting the child's file
descriptors for stdin and stdout with pipes, and then exec'ing the
command.
--
Topher Fischer
GnuPG Fingerprint: 3597 1B8D C7A5 C5AF 2E19 EFF5 2FC3 BE99 D123 6674
javert42@cs.byu.edu
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
next reply other threads:[~2007-03-21 20:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-21 20:01 Topher Fischer [this message]
2007-03-21 20:39 ` Getting output from another program leslie.polzer
2007-03-21 20:43 ` Mathieu Dube
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46018F0A.9010801@cs.byu.edu \
--to=javert42@cs.byu.edu \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).