Re: [LIP] Fwd: Using libmagic to check file type
Kumar Appaiah <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jul 15, 2009 at 04:01:29PM +0530, Arun Sharma wrote: > My reply didn't make it to the list.. > > ---------- Forwarded message ---------- > From: Arun Sharma > Date: Wed, Jul 15, 2009 at 7:36 AM > Subject: Re: [LIP] Using libmagic to check file type > To: Technical discussions about programming under Linux systems > > On Wed, Jul 15, 2009 at 12:41 AM, Kumar Appaiah > <[3][email protected]> wrote: > > Dear LIP, > > I wish to use libmagic to verify whether the file I am currently > scanning is of a particular type. One possible way (which I've seen > being used) is to get the string which libmagic returns, and see if it > matches the pattern I expect. Is there a more "correct" way of > matching, say with an enumeration of file types and matching against > that, or is the former method the way it should be done? > > Since the database of file types is not a part of the API and is > pluggable, I don't see how the API can have an enum of file types. > -Arun Right. I just wanted to be sure that there isn't an 'elegant' way which I was missing. Thanks a lot! Kumar -- Kumar Appaiah ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge