Difference between Text And Binary
I would appreciate some help regarding what is the difference between Binary and Text. For example:
char s = "bytes";
s is a bunch of bytes that you tell the compiler to treat them as an array of chars.
1) How do you convert this to an array of bytes using C? (binary mode)
2) If you explore a string with an Hex Editor, what are the differences in memory if you have this string in a text mode or if you have it in a binary mode?
Difference between text and binary
Binary was designed for efficiency when transmitting text only files. Binary is strictly a 7 bit character representation. Binary says the eighth bit does not matter so we will only transmit 7 bits and this is where the efficiency comes into play. You might remember modem settings can be set to 8N1. This means 8 data bits no parity and one stop bits. If you wanted to save some transmission time downloading a text file you could set your modem to 7E1.
This way the modem transmits seven data bits per character and saves you some transmission time. This setting drops the high bit which is realy not relevant to the ASCII character set in the range of 0-127. The FTP protocol can also be set to binary prior to transmission of text files. If the eigth bit is critical for transmitting binary files such as program executables 8 data bits must always be sent. Likewise if you use the extended IBM ASCII chacter set
in the range 128-255 (example ASCII 195 represents ├ ) then 8 bits must also be transmitted. Remember this was invented back in the days when 300 baud modems were used. Hope this gives some insight into the pupose and history of binary transmissions of character text.