22/06/08 7:26
Il Totem
// Select the file
OpenFileDialog file = new OpenFileDialog();
file.Title = "Select a file";
file.Filter = "All Files (*.*)|*.*";
file.ShowDialog();
textBox1.Text = file.FileName;
// Open and Read the file
Stream new_stream = File.Open(file.FileName, FileMode.Open, FileAccess.Read);
BinaryReader bw = new BinaryReader(new_stream);
while (bw.PeekChar() >= 0)
{
textBox2.Text += bw.ReadChar();
}
bw.Close();
bw.ToString ti restituisce la stringa "System.IO.BinaryReader" e non legge niente, quindi non avanza di posizione. In conclusione PeekChar restituisce sempre il valore del primo byte, e sempre maggiore di -1.
Ultima modifica effettuata da Il Totem 22/06/08 7:29
aaa