Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Two functions into one
Message
De
27/06/2006 11:48:36
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
27/06/2006 11:38:58
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01131998
Message ID:
01132053
Vues:
9
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform