Well, you understand that every file that has content is a binary file, every single one without exception, including a file with a .txt
extension.
The one and only difference between a binary file with a .txt
extension and one with a .jpg
extension is really a meta difference: convention and historical practice tell us that we can make assumptions about the first file:
- it is to be interpreted as a collection of contiguous 8-bit fields;
- each such field represents an ASCII character; and
- most important, there are no control fields -- no counts, no state-change indicators, none of that.
Otherwise, there's no difference between what we -- only by convention -- call a text file and any other file.
Furthermore, there is no way to know how a file should be interpreted just by looking at its contents. We have to depend upon something external to the file -- like its extension, say -- to give us a hint at what the thing is.