I'm writing a multitool designed to work solely on images (specifically, JPEG, PNG, and GIF).
Part of the tool is to iterate over the files in a directory and, for each one, verify that if the file's extension is (for example) ".png" that the file itself is, indeed, a PNG (and, obviously, to change the file's name in case of a mismatch).
The iteration and text processing is easy enough. What I need is a means by which I can get the filetype of a given file.
And, ideally, I would want this to be OS-neutral enough for me to compile the program for both Windows and Linux versions.