[File] use file command in c

Christoph Biedl astron.com.bwoj at manchmal.in-ulm.de
Sun May 17 08:48:06 UTC 2020


Vikas Talan wrote...

> I am looking for an alternative way to use file command in C programming
> without using system commands like exec(), system(),Runtime.exec() etc that
> makes this program trivial.

It's all there: The file program is just a frontend to the libmagic
library that does all the detection. So all you have to do is to link
your application against that library. The API calls are documented in
the libmagic manpage, and the file proram itself is an example of how to
use it, although a rather complex one.

    Christoph


More information about the File mailing list