* Getting output from another program.
@ 2007-03-21 20:01 Topher Fischer
2007-03-21 20:39 ` leslie.polzer
2007-03-21 20:43 ` Mathieu Dube
0 siblings, 2 replies; 3+ messages in thread
From: Topher Fischer @ 2007-03-21 20:01 UTC (permalink / raw)
To: linux-c-programming
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Getting output from another program.
2007-03-21 20:01 Getting output from another program Topher Fischer
@ 2007-03-21 20:39 ` leslie.polzer
2007-03-21 20:43 ` Mathieu Dube
1 sibling, 0 replies; 3+ messages in thread
From: leslie.polzer @ 2007-03-21 20:39 UTC (permalink / raw)
To: Topher Fischer; +Cc: linux-c-programming
[-- Attachment #1: Type: text/plain, Size: 388 bytes --]
On Wed, Mar 21, 2007 at 02:01:14PM -0600, Topher Fischer wrote:
> 1. Is there a C library that provides equivalent or similar
> functionality (especially for identifying MIME types)?
libmagic (part of 'file' package)
libgmime (part of 'gmime' package)
Leslie
--
NEW homepage: https://viridian.dnsalias.net/~sky/homepage/
gpg --keyserver pgp.mit.edu --recv-keys DD4EBF83
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Getting output from another program.
2007-03-21 20:01 Getting output from another program Topher Fischer
2007-03-21 20:39 ` leslie.polzer
@ 2007-03-21 20:43 ` Mathieu Dube
1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Dube @ 2007-03-21 20:43 UTC (permalink / raw)
To: linux-c-programming
On Wed, Mar 21, 2007 at 02:01:14PM -0600, Topher Fischer wrote:
> 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.
>
have you checked popen?
-M
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-21 20:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-21 20:01 Getting output from another program Topher Fischer
2007-03-21 20:39 ` leslie.polzer
2007-03-21 20:43 ` Mathieu Dube
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).