Stream Reader

I

Ian Oldbury

I'm having a problem reading from a flat file, in the file single character
"£" and "»" exist
however when i view the contents of the file line by line these characters
don't exist.

Has anyone got any suggestions????

Here is the code...

Dim LineContents as string
Dim fs As FileStream
Dim sr As StreamReader

fs = New FileStream("c:\product.txt", FileMode.Open, FileAccess.Read,
FileShare.Read)
sr = New StreamReader(fs)

While sr.Peek > -1
LineContents = Convert.ToString(sr.ReadLine)
End While
 
D

David Browne

Ian Oldbury said:
I'm having a problem reading from a flat file, in the file single
character "£" and "»" exist
however when i view the contents of the file line by line these characters
don't exist.

Has anyone got any suggestions????

Here is the code...

Dim LineContents as string
Dim fs As FileStream
Dim sr As StreamReader

fs = New FileStream("c:\product.txt", FileMode.Open, FileAccess.Read,
FileShare.Read)
sr = New StreamReader(fs)

Specify the encoding:

StreamReader Constructor (Stream, Encoding)
http://msdn.microsoft.com/library/d.../html/frlrfSystemIOStreamReaderClassTopic.asp

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top