473,770 Members | 5,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

read extended ascii values

33 New Member
hi,
i read the ascii value from a file and wrote the decimal one in other file.
But values above "127" i.e. extended ascii are printed as" 65533."
here ais wat i did:
Expand|Select|Wrap|Line Numbers
  1. private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             int[] b = new int[100000];
  4.             StreamReader sw = new StreamReader("c: \\28D.09N");
  5.             for (int i = 0; i < 5000; i++)
  6.             {
  7.                 b[i] = sw.Read();
  8.                 //int c = sw.Read();
  9.                 //int a = (int)c;
  10.                 Console.WriteLine(b[i]);
  11.             }
  12.             /*SaveFileDialog sv = new SaveFileDialog();
  13.             sv.Filter = "text file|*.txt";
  14.             if (sv.ShowDialog() == DialogResult.OK)
  15.             {*/
  16.                 StreamWriter sr = new StreamWriter("c: \\bin28D.txt");
  17.                 for (int i = 0; i < 5000; i++)
  18.                 {
  19.                     sr.WriteLine(b[i]);
  20.                 }
  21.                 sw.Close();
  22.             }
any help for the extended ascii values plzzz
Dec 12 '09 #1
5 4679
tlhintoq
3,525 Recognized Expert Specialist
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

Sid: Let me be clear here. You have started over a dozen threads. You have been told this many times. If you can't be bothered to format your questions to make it easier on the volunteers trying to help you, then I wouldn't be surprised if the volunteers here just stopped reading your questions.
Dec 12 '09 #2
siddhanta
33 New Member
thanx for the tips
but i was expeting the solution
Dec 12 '09 #3
tlhintoq
3,525 Recognized Expert Specialist
thanx for the tips
but i was expeting the solution
Yeah, that is what I am coming to realize from all of your posts... You are expecting the solutions from someone else.
Dec 12 '09 #4
tlhintoq
3,525 Recognized Expert Specialist
Have you considered that you might have to read up on the functions you are using so you *understand* what they are doing?

For example: Reading the MSDN page for streamreader reveals
StreamReader defaults to UTF-8 encoding unless specified otherwise, instead of defaulting to the ANSI code page for the current system. UTF-8 handles Unicode characters correctly and provides consistent results on localized versions of the operating system.
Dec 12 '09 #5
tlhintoq
3,525 Recognized Expert Specialist
Do you know for FACT what the contents of the file are and how they were written? Or are you assuming it is ASCII?

HINT: Streamwriter also defaults to UTF-8, so if you wrote the file thinking it was ASCII then it is possible that streamwriter converted it to unicode.
Dec 12 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3787
by: | last post by:
Hey all, Quick question...been bugging me for some time, really. I have a console app, it does some things, and I want to save an array of text to a text file. The text consists of ASCII and extended ascii (codes 0 to 255). I am using ofstream to output, and this is the line doing the actual output: outfile << screenbuffer.Char.AsciiChar; Note that screenbuffer is an array of type 'CHAR_INFO', quick info of it here: ...
13
7778
by: bgbauer70 | last post by:
My appologies if this ends up being a duplicate post. For some reason the first post never showed up. I've tried about 300 iterrations of this same ability, and none of them seem to work in Firefox. Take the following code for example. It WILL stop me from entering zero into the first text box, but it wont stop me from entering extended ascii characters (which is the final goal).
13
2503
by: kristofvdw | last post by:
Hi, I have to treat a given text file, but haven't got a clue which extended ASCII set it is using. Opening the file in Windows' Notepad or in DOS, all accented letters and symbols are wrong. Any idea how to identify the subset used? Is there some text editor which can cycle easy through all known subsets, or even better: cycle subsets automatically until found a given test-string with some accents and symbols?
4
3851
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII characters"(No. 128 to 255) . e.g., in one version No. 224 is the symbol alpha, in another, it's a "a" with a ` on it... How come? You can see it here: http://www.kturby.com/cables/ascii2.htm
1
2138
by: Blent stn | last post by:
Hi, im trying to upload somefiles using sockets to a FTP site. But i've some problems with extended ascii characters. When i try "MKD blent" the created folder is "blent". The directory name is kept in a string. What should i convert its encoding to? If you have any idea to solve this, please reply. Thanks
0
1484
by: brrrdog | last post by:
Whenever I write to Response.Outputstream after doing a plain response.write, I get a delimiter between the two writes that is made up of three extended ascii chars (decimal equivalents 239, 187, 191). This doesn't seem to upset the browser but i'm wondering what this sequence is for? Is there a way to turn it off? Example: Excuting the following code... private void Page_Load(object sender, System.EventArgs e)
17
11821
by: Gregor Kovač | last post by:
Hi! Does DB2 handle extended ASCII table? Example: VALUES(CHR(65)) =A VALUES(CHR(129)) =null, but according to www.asciitable.com should be u with umlaut. Any idea ?
1
2676
by: s123 | last post by:
Hi, while invoking a web service, if in xml request message i wrap the extended ASCII characters with CDATA it is not returning the desired result, while this is not the case if i do not wrap them with CDATA. I can not ignore the use of CDATA as for characters "<" and "&" i need to use it. I am not getting why it is not recognizing the Extended ASCII characters correctly when they are wrapped with CDATA, the problem is there only with DB2...
13
48086
by: ramif | last post by:
Is there a way to print extended ASCII in C?? I tried to code something, but it only displays strange symbols. here is my code: main() { char chr = 177; //stores the extended ASCII of a symbol printf("Character with an ascii code of 177: %c \n", chr); //tries to print an ASCII symbol...
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.