c# - Reading a binary file into a textblock -


I want to read an exe or any binary file content in a text block in C #. I have the following code, but when I start reading the file, the application is stuck. My code is given below:

 using  (file stream fs1 = new file stream (phapath, flamod.open, file entry read)) {byte [] buf = new byte [ 1024]; Int size = 0; While ((size = fs1.Read (buf, 0, buf.Length)) gt; 0) {Console.Write ("[" + buf.Length + "/" + size + "]); textbox.ext + Encoding.default.getstring (buf)}}   

Please guide me how I can solve this problem.

If you want to read the entire file, you can use it.

  byte [] bytes = file .ReadLabets (Payapath ); TextBox.text = encoding.default.getstrings (bytes);   

When you read the chunks, then this whole d Code can not represent the string can sometimes ended characters require more than one byte and separate segments.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -