Some sort of API to get Linux "file" functionality?

Ok, this is the problem i'm facing: I'm currently writing an application where i need to determine whether a file is text-only no matter what their extension is. This would allow me to not only detect the type of a file even if it has a wrong extension but also be able to detect ANY text based file no matter what their extension is.

I know the "file" utility on linux ( located under /usr/bin/file for me ) does this job quite alright, so I was wondering whether this could be achieved on C by invoking some sort of function under some system header file ( i don't mind installing more source packages ).

I'm not really willing to add system() calls, and as long as it works on *NIX its fine.
Maybe boost::filesystem has something that you are looking for.
Topic archived. No new replies allowed.