This is not a 100% correct question, in fact. In reality: all files are binary. This is a kind of jargon: usually a file is called a text file if does not contain any representations of numeric data at all or such data is represented using human-readable "text mode". This is rather a kind of jargon. Any file can actually contain a mixture of different representation.
Let's consider a 32-bit integer int
value = 0x1234ABCD;
. In needs minimal 4 byte to write it. (0xCD, etc.). It depends on the data type and does not depend on the value.
At the same time you can write it as a string in hexadecimal form "0x1234ABCD" or in decimal form as "305441741", 10 or 9 characters, and each character will take 1 byte in Unicode UTF-8 or ASCII encoding or 2-byte words in UTF-16 encoding, and the length if representation depends both on the value and the format. For example, compare "12345", "3" and "0003". In the case of such string representation, it's usually called "text format". By the way, the notions of "hexadecimal" or "decimal" are relevant only to such "text format".
There is a number of other forms of representations of numeric and other data. The ways of presentation I have described are used more often, that's why those confusing terms are used. They are really somewhat confusing, many beginners have some troubles with them.
Please see also:
http://en.wikipedia.org/wiki/Text_file[
^].
—SA