473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Stream Reader

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
Nov 19 '05 #1
2 1107

"Ian Oldbury" <ian_oldbury@_NO_msn_SPAM_.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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/de...ClassTopic.asp

David
Nov 19 '05 #2
cheers

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:eQ****************@TK2MSFTNGP15.phx.gbl...

"Ian Oldbury" <ian_oldbury@_NO_msn_SPAM_.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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/de...ClassTopic.asp

David

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents...
5
by: Drew Yallop | last post by:
I read an XML file with a stream reader in VB.Net. When I look at the stream reader output in debug mode (by passing cursor over the stream reader object)the format is a perfect replica of the...
10
by: John Kraft | last post by:
Hello all, I'm experiencing some, imo, strange behavior with the StreamReader object I am using in the code below. Summary is that I am downloading a file from a website and saving it to disk...
3
by: Martin Z | last post by:
Hi, I have an application that involves sending a lot of XML data to various places. The problem is that once in a while, I just want the XML document as a string (for example, sending to a...
2
by: Jack | last post by:
Hi, I want to read a string a chars from a stream, and put it into a string. At the moment, I'm creating a buffer of a fixed size, and reading the stream of text into it. It works, but I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.