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

char to wchar_t conversion

wchar_t c1 = wchar_t('A');
wchar_t c2 = L'A';

Is c1 equal to c2?

If they are not equal, how can I create wchar_t character representing the
same character as some char value?

cheers,
Marcin
Dec 7 '05 #1
1 6866
Marcin Kalicinski <ka****@poczta.onet.pl> wrote:
| wchar_t c1 = wchar_t('A');
| wchar_t c2 = L'A';
|
| Is c1 equal to c2?

I could not find any guarantee for that in the C++ standard. The only
guarantee i found is that both char(0) and wchar_t(0) shall both have
only zero bits. Apart from that the standard only has limited demands
on the character sets represented by char and wchar_t. Amongst others,
both shall contain the letter A, and rest of the English characters.

| If they are not equal, how can I create wchar_t character representing the
| same character as some char value?

Create a conversion function for the target system. It will probably
port easily if you need it to. Your compiler's documentation should
contain information on how you can write the function.

Since you are asking, you are probably interested in the iconv function,
which is present on UNIX systems. See <URL: http://www.gnu.org/software/libiconv/>,
or search the web.
--
Robert Bauck Hamar
Dec 7 '05 #2

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

Similar topics

2
by: Peteroid | last post by:
The following code: char x_char = '0' ; String^ x_str = c_char.ToString( ) ; results in: x_str = = "48" and not:
23
by: Steven T. Hatton | last post by:
This is one of the first obstacles I encountered when getting started with C++. I found that everybody had their own idea of what a string is. There was std::string, QString, xercesc::XMLString,...
2
by: Alejandro Aleman | last post by:
Hello! i know this may be a newbie question, but i need to convert a string from System::String^ to char*, in the msdn page tells how, but i need to set to /clr:oldSyntax and i dont want it...
4
by: uday.sen | last post by:
Hi, I need to convert a string from UTF8 to wide character (wchar_t *). I perform the same in windows using: MultiByteToWideChar(CP_UTF8, 0, pInput, -1, pOutput, nLen); However, in linux...
1
by: Suman | last post by:
Hello All, Given a structure: struct s { char *name; wchar_t *surname; }; I wish to define a friend function for the above struct: std::ostream& operator<<(std::ostream& out, const s& x);
0
by: Khadar123 | last post by:
CString str,s; str = _T("DATA"); / str = "DATA"; const wchar_t *c = sPorts.GetBuffer(0); s.Format(_T("%s"),c); AfxMessageBox(s); or Printf/cout.....
1
by: George2 | last post by:
Hello everyone, Here is the code, and if I change line from static wchar_t* p = {PREFIX((wchar_t*)_TEXT("FOO"))}; to static wchar_t* p = {PREFIX(_TEXT("FOO"))};
1
by: dynature | last post by:
Hi, Any help, how to convert float to unicode string? gcvt() wont work on visual c++ 2005. Thnks in advance - nestor
5
by: Samant.Trupti | last post by:
Hi, There is one thing I am cofused about.... If I have a declareation say char str; Now if I want to change it to wchar so do I have to change it like .... wchar_t str; or double the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.