473,385 Members | 1,912 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,385 software developers and data experts.

StreamReader FileInfo

I am reading a text file using the StreamReader class, I am looking for
prices of goods i.e. DAB Radio £230.00
As I read each line, I notice that the £ (pound) sign is missing
can anyone shed light on this issue?

code snippet......

StreamReader sr = fi.OpenText(); (fi being the text file)

while ((s = sr.ReadLine()) != null)
{
...read line into string here
}
Nov 17 '05 #1
1 3712
sorry, i have found the answer, need to encode the stream

Encoding ecp1252 = Encoding.GetEncoding( 1252 );
StreamReader sr = new StreamReader( fi.FullName, ecp1252, false );

"Richard Steele (Basemap)" wrote:
I am reading a text file using the StreamReader class, I am looking for
prices of goods i.e. DAB Radio £230.00
As I read each line, I notice that the £ (pound) sign is missing
can anyone shed light on this issue?

code snippet......

StreamReader sr = fi.OpenText(); (fi being the text file)

while ((s = sr.ReadLine()) != null)
{
...read line into string here
}

Nov 17 '05 #2

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

Similar topics

2
by: Joecx | last post by:
Using vb.net, I am using Streamreader to read a text file and searching for a line to delete, the I close the file and open it as a streamwriter so I can put the new file back to disk without the...
7
by: BlueOysterCult | last post by:
Hello all I have a project that I have to read the file - which I have done I can see the file output. I then need to read the line - parse the line into three separate values (there are 3 = name...
2
by: John Bowman | last post by:
Hi All, ..NET 1.1... I'm wondering if there is any approach more convenient to get a list of FileInfo objects than the following. For example, if I wanted to get 1 list of all the Exe's and all...
5
by: Lance | last post by:
I want to expose properties of a class to a user via a PropertyGrid class. Some of the properties are of type System.IO.FileInfo. Ideally, an OpenFileDialog window would appear when the user...
3
by: rn5a | last post by:
To work with files, when should one use the File class & when should one use the FileInfo class? Similarly, to work with directories, when should one use the Directory class & when should one...
4
by: Mike R | last post by:
Hi All, I'm trying to read a file that has the following format, its a variable record file, the first byte determines how to process the rest. byte 1 = either 0,1,2,3 4 bytes = size of the...
0
by: comp.lang.php | last post by:
if (!function_exists('mime_content_type_fileinfo')) { /** * Will use {@link http://us2.php.net/fileinfo FileInfo} functions provided within {@link http://pecl.php.net PECL} bundle to return mime...
1
by: comp.lang.php | last post by:
<pre> if (!function_exists('mime_content_type_fileinfo')) { /** * Will use {@link http://us2.php.net/fileinfo FileInfo} functions provided within {@link http://pecl.php.net PECL} bundle to return...
1
by: cathy25 | last post by:
Hi, I am using the following code to read a file. DirectoryInfo dir = new DirectoryInfo(@"C:\"); try { if (dir.Exists) { ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.