Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Two functions into one
Message
From
27/06/2006 11:48:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/06/2006 11:38:58
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01131998
Message ID:
01132053
Views:
8
>>IMHO VFP FileToStr() equivalant is BinaryReader not StreamReader.
>
>I cannot see how I can have a universal method by using BinaryReader which I would be able to use to read text file. For example, I could have the following:
>
>
>Dim loBinaryReader As IO.BinaryReader
>Dim loByte() As Byte
>Dim loFileStream As IO.FileStream
>loFileStream = New IO.FileStream(tcFileName, FileMode.Open, FileAccess.Read)
>loBinaryReader = New IO.BinaryReader(loFileStream)
>loByte = loBinaryReader.ReadBytes(CType(loFileStream.Length, Integer))
>
>
>As this point, I have an object Byte. If I am reading a text file, how can I convert this object back to a string?

myString = BitConverter.ToString(loByte)

PS: Sorry not this one. Hang on:)
Private Function UnicodeBytesToString( _
    ByVal bytes() As Byte) _
    As String

    Return System.Text.Encoding.Unicode.GetString(bytes)
End Function
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform