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

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.tmp");
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<<endl;
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 1823
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.tmp");
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<<endl;
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**********@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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.characters.
Jul 22 '05 #3

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

Similar topics

37
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...
10
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
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...
4
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...
15
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....
44
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...
32
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...
13
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...
13
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...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.