I'm taking a compiler design course now, and the first project is to write a rudamentary lexer. The next part of the project will involve using lex, so this program is mainly here to build an appreciation for how easy lex makes stuff

Anyway, I am trying to add a feature (it is not required, nor is it extra credit; I just want it there) that will allow the program to distinguish between text files and binary files. I should be able to parse a file that contains C++ code, for example; I should not be able to parse a compiled C++ program. How do I go about doing this?