[lug] C(++) library to detect file type (a la 'file')

Scott A. Herod herod at dimensional.com
Thu Oct 31 10:17:47 MST 2002

rm at fabula.de wrote:
> Hello everyone,
> i'm looking for a (GPL comaptible) library that implements file type
> detection similar to 'file(1)'. The only stuff i found so far is:
>  - in libgnome (which i'd hate to have to install on a server)
>  - There's an article and software package on freedesktop.org that
>    address the need for a unified 'file magic' database, but  that
>    lacks a client program/library to query the database.
>  Any pointers (or &references) would be highly welcome.
>  TIA Ralf Mattes

Hi Ralf,

Why not just use file?  You could either make a system call, or build
your own utility from the code for the system command.  The magic
configuration file seems to be the key piece.


More information about the LUG mailing list