c# - Stream reader.Read number of character -


is there stream reader class read number of char string or byte byte[]?

forexample reading string:

string chunk = streamreader.readchars(5); // read next 5 chars 

or reading bytes

byte[] bytes = streamreader.readbytes(5); // read next 5 bytes 

note return type of method or name of class not matter. want know if there thing similar can use it.

i have byte[] midi file. want read midi file in c#. need ability read number of bytes. or chars(if convert hex). validate midi , read data more easily.

thanks comments. didnt know there overload read methods. achieve filestream.

        using (filestream filestream = new filestream(path, filemode.open))         {             byte[] chunk = new byte[4];             filestream.read(chunk, 0, 4);             string hexletters = bitconverter.tostring(chunk); // 4 hex letters need!         } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -