473,473 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

wchar_t to char[128]

Hi
how do i convert wchar_t to char[128] or vice versa

Kind Regards
Dec 6 '07 #1
1 3510
[c and c++ are not the same langauge; my answer is for c (since you posted
to clc) so i'm not following your followup-to.]

in comp.lang.c i read:
>how do i convert wchar_t to char[128] or vice versa
a single wide-character can be converted to a multi-byte character sequence
with the wctomb function.

if the wchar_t corresponds with a single char then wctob may be used, and
you may use it to determine if such is the case, though if you are prepared
for up to MB_CUR_MAX bytes of result you may as well just use wctomb.

to convert a multi-byte character sequence into a wide-character use mbtowc.
if you have string of multi-byte characters then look at mbstowcs, which
produces a wide-character string result.

each of these may fail so be sure to pay attention to the return value.

--
a signature
Dec 6 '07 #2

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

Similar topics

8
by: Michael R. Copeland | last post by:
What is a good way to delete 1 character (or several) from a character array that's being processed as a "string"? Specifically, I have something like: char szWork; .... strcpy(szWork,...
16
by: AA | last post by:
I am trying to print a table of what integer corresponds to what character. Can someone please tell me what is wrong with this code? #include <stdio.h> int main() { char line; /* each...
8
by: poodles | last post by:
I'm trying to find out the ranges of different data types through direct computation........this is what I did....... Code: #include <stdio.h> main() { char ch; signed short sh;
42
by: sarathy | last post by:
Hi, I need clarification regarding signed characters in the C language. In C, char is 1 byte. So 1. Unsigned char - ASCII CHARACTER SET - EXTENDED CHARACTER SET
6
by: SteelSide | last post by:
Ive searched and searched,but havent been able to get it to work. ----------------- #include <iostream> using namespace std; std::string tempHostNameStr = "s1e2.hidden.thingy.org"; char...
2
by: Jason | last post by:
Hi, I was wondering if anyone could advise me on this. Right now I am setting up a DB2 UDB V8.2.3 database with UTF8 character set, which will work with a J2EE application running on...
3
by: mohidsheik | last post by:
Please help me whether the following method to delete the memory which is created dynamically in another function is correct or not long newValues ( char** pszValue) { *pszValue = new...
0
by: Manoj Jangid | last post by:
hi how do i convert wchar_t* to char or char to wchar_t* Kind Regards
16
by: Michael Brennan | last post by:
I guess this question only applies to programming applications for UNIX, Windows and similiar. If one develops something for an embedded system I can understand that wchar_t would be unnecessary. ...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.