My program accepts STL (the 3d printing type) files, and currently works with the ASCII type.
I would like to create a process that identifies the file as either ASCII or binary.
I am thinking that the header is enough to tell the difference, as an ASCII header begins with the word "solid" while binary files never do.
How would I extract the first word of the file and interpret it as either "solid" or something else?
You can iterate over the bytes of the file and use std::isprint from <cchar> to test whether the character is printable. If there are nonprintable characters in the file, chances are it's a binary file.