473,566 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does somebody know how to print out wild character with unicode value greater than 255

Here is my prolem: i try to output wstring with unicode value greater
than 255(for each wchar_t) to a file such as test.tmp. Here is my code:

wofstream outdata("test.t mp");
wstring s;
long l1=256;
long l2=250;
wchar_t c1=(wchar_t)l1;
wchar_t c2=(wchar_t)l2;
s+=l1;
s+=l2;
outdata<<s<<end l;
outdata.close() ;

However, there is nothing showes in the output file. But if i assign
any positive value less than 256 to l1 such as: long l1=255, it works
fine.
could someone please tell me what is wrong with my code and the
solution for it?
thanks!

Jul 22 '05 #1
2 1833
jackie wrote:
Here is my prolem: i try to output wstring with unicode value greater
than 255(for each wchar_t) to a file such as test.tmp. Here is my code:

wofstream outdata("test.t mp");
wstring s;
long l1=256;
long l2=250;
wchar_t c1=(wchar_t)l1;
wchar_t c2=(wchar_t)l2;
s+=l1;
s+=l2; Don't you want c1 and c2 here?
outdata<<s<<end l;
outdata.close() ;


Did you examine the output file with something that can inspect the
characters? Maybe your font doesn't have anything in those positions.
250 I don't even know what it should be. 256 is an A with a flat bar
over it...not a common character.
Jul 22 '05 #2
"jackie" <ia**********@h otmail.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Here is my prolem: i try to output wstring with unicode value greater
than 255(for each wchar_t) to a file such as test.tmp.


Is it actually writing some characters to the file or is the file totally
empty?

If the former, you might try explicity opening the file as binary. If you
open it as text, your characters may converted to unreadble
ASCII.character s.
Jul 22 '05 #3

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

Similar topics

37
10130
by: chandy | last post by:
Hi, I have an Html document that declares that it uses the utf-8 character set. As this document is editable via a web interface I need to make sure than high-ascii characters that may be accidentally entered are properly represented when the document is served. My programming language allows me to get the ascii value for any individual...
10
55858
by: Amuro | last post by:
I want to print a string value that represent temperature. how to print the 'little superscript circle' in C#? thx...
29
3322
by: Vol | last post by:
I think 'atan' can get the angle but it is not the four quadrant angle. Is there any function that i can get the angle from -pi to pi? or I have to use some if ... else? I know in Matlab, we use 'atan2( )' Also, is there any function to get the round value, similar with floor and ceil, such like: round(3.1) = 3 round(3.6) = 4
4
2982
by: Antimon | last post by:
Hi, I need to convert a unicode string to ASCII. I can simply use getbytes method to do that but i would use some characters since Unicode is 16bit. But i thought there might be some way to convert characters like "ü" to "u" or, "å" to "a". Or a chance i can find a conversation table? Thanks.
15
18300
by: pkaeowic | last post by:
I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug? if (e.KeyChar == '\e') { this.Close(); }
44
9442
by: Kulgan | last post by:
Hi I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text). I have two main questions: 1. Does IE automaticall convert text input in HTML forms from the
32
2074
by: lovecreatesbea... | last post by:
In C++ Primer 4th, sec 3.3.2, it states that C++ programmers use != rather than < in a for loop. The following small snippet erases punctuations in a string. It works well with < used in the for loop but it breaks when != is used instead. #include <string> #include <iostream> #include <exception> #include <cctype>
13
48040
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...
13
3871
by: =?Utf-8?B?YXVsZGg=?= | last post by:
i have come across a situation in my project where i read a text file with some characters greater than hex 0x7f. i need to write character (0xE0) to a new file as an exception. however when i attempt to write this via "Console.Write" or "filestream.Write" it seems the value changes. most of the output file is in text mode. if i view the...
0
7666
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
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...
0
7888
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. ...
0
8108
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...
0
6260
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
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...
0
3643
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...
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
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...

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.