I have been a programmer for several years, but I never had to understand low-level operations with bytes. This interests me, and I would like to know more about working with bytes.
In the code below, I am reading a text file containing only the words "hello there."
FileStream fileStream = new FileStream(@"C:\myfile.txt", FileMode.Open);
byte[] mybyte = new byte[fileStream.Length];
fileStream.Read(mybyte, 0, (int)fileStream.Length);
foreach(byte b in mybyte)
Console.Write(b);
Console.ReadLine();
In this case, the mybyte variable contains numeric values ββthat appear to represent the decimal ASCII character. However, my bytes represent bits, which in turn represent binary values. When reading a byte, I would expect to see a binary value like "0001010", not "104", which is the ascii character for "h".
, persepctive . , , , Ascii, , , , ascii, - ( , ).
, , , , .
- .net- ( ). .
, " ", myfile.txt
,
