FlyBoy Posted September 17, 2004 Posted September 17, 2004 im reading a book ... and now im in the phase of binary data..converting from string\and\or any other data types to binary and vice versa, using bitconverter ,memorystream,binarywriter,binaryreader. my question is...what the use of converting data to binary???? why do i need this??? (except from encoding files and such...) 10x in advance. Quote
Leaders Iceplug Posted September 21, 2004 Leaders Posted September 21, 2004 Converting a string to binary is useless as it will appear in the file exactly how you wrote it. However, if you were to store numbers in the file, only the binary data will be stored instead of the string representation of the number. For instance, if you wanted to store the number 2147483467 to a file, you'd have a 10 byte large file if you saved it with the StreamWriter. If you saved it with the StreamReader, you'd have garbage looking characters like this: ÿÿÿ, but the file would be only 4 bytes. You can read the number back using the StreamReader. Also, if someone were to open the file, they would have difficulty figuring out that ÿÿÿ is the 2147483467. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.