|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB BinaryReader, reading Characters from streambeing transformed into a cr-lf pair! I am reading a sequence of bytes from a binary file, one part of which is a text string. Here is a code snippet: Dim fs As New FileStream("c:\test.bin", FileMode.Open) Dim br As New BinaryReader(fs) Dim str As String str = br.ReadChars(10) Debug.WriteLine(str) if the test.bin file contains the characters 1234567890, there is no problem: the output is 1234567890 but if it contains the text 12345à7890 then i get an output of : 12345 7890 Any accented character is turned into a cr-lf pair! How can I read in a 10 byte binary sequence and store it as a string? Thanks for any pointers, James James,
You have to pass in the appropriate Encoding to the BinaryReader constructor. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message Thanks for that,news:uPdlVLvUGHA.1728@TK2MSFTNGP11.phx.gbl... > James, > > You have to pass in the appropriate Encoding to the BinaryReader > constructor. > > Mattias James
Class question
Form Exit Doing some extra task while saving databind Controls in VB.Net 2005 ? Dynamically Loading Programs Adding HTML code to project. SQL Server and ADO.Net best method select all text when textbox1 is clicked Auto-stop DUN via VB.Net? Re: ContextSwitchDeadlock was detected GetType of custom Property set to nothing |
|||||||||||||||||||||||