-
reading a file
hummm I get a strange result when I try and read a file and put its contents in a textbox... here is the code:
<code>
string strPath= "C:\\test.log";
FileStream logFile = new FileStream(strPath, FileMode.Open);
int len =(int)logFile.Length;
byte [] logdata = new byte [len];
logFile.Read(logdata,0,len);
txtLogFile.Text = logdata.ToString();
</code>
for some reason the output (regardless of the file contents) is "System.Byte[]"
Any ideas? or know the right way to do this?
-
What kind of data is in test.log?
Anyway try this.
Code:
string strPath= "test.log";
FileStream logFile = new FileStream(strPath, FileMode.Open);
int len =(int)logFile.Length;
byte [] logdata = new byte [len];
logFile.Read(logdata,0,len);
textBox1.Text = Convert.ToBase64String(logdata);