Questions tagged [wchar-t]

`wchar_t` is a fundamental data type in the C and C++ programming languages, and it stands for "wide character". Its intended use is to hold any character value from "the system's character set".

wchar_t is the fundamental "wide character" data type in the C and C++ programming languages. Both language standards are intentionally vague on what it is for, specifying only that it can hold any character value "from the system's character set". There are conversion functions to and from the system's narrow, multibyte character encoding, a concept left equally vague (the functions are mbtowc() and wctomb()).

The fact that the C and C++ language standards are at once encoding-agnostic yet also provide for a way to represent an extended character set is the source of much confusion for people who expect explicit guarantees of certain fixed encodings (such as UTF-8 or UTF-32).

The practical use of the wchar_t type is considered debatable by some programmers.

479 questions
0
votes
1 answer

Wide characters string literal

I have troubles with wide string literals using MinGW GCC compiler on Windows. When I read the user input using wscanf, wprintf outputs correct national characters. However wide string literals stops output at the first national character: wprintf…
Jan Turoň
  • 31,451
  • 23
  • 125
  • 169
0
votes
1 answer

Separating null byte separated UNICODE C string

First off, this is NOT a duplicate of: Turn a C string with NULL bytes into a char array , because the given answer doesn't work when the char *'s are Unicode. I think the problem is that because I am trying to use UTF-8 encoded char *'s instead of…
Alec Gorge
  • 17,110
  • 10
  • 59
  • 71
0
votes
1 answer

Have a PCWSTR and need it to be a WCHAR[]

I am re-writing a C++ method from some code I downloaded. The method originally took a PCWSTR as a parameter and then prompted the user to enter a file name. I modified the method to take two parameters (both PCWSTR) and not to prompt the user. I am…
Nick O
  • 39
  • 4
0
votes
1 answer

find and replace occurrence with wchar_t

I need to develop a small function to find occurrence in a wchar_t sequence of character. this function take as input the the pointer wchar_t* to a string, but as it's unicode the value of every single character is displayed as a number…
UncleSax
  • 148
  • 2
  • 16
0
votes
2 answers

C++ how to get the next multibyte character

Is their a way to get the next full character in a multibyte string for example "z\u00df\u6c34\U0001d10b" or "zß水" would be represented as 4 characters excluding null termination in a widestring but maybe 9 characters in a multibyte string. I was…
kdgwill
  • 2,129
  • 4
  • 29
  • 46
0
votes
1 answer

wcscpy_s not affecting wchar_t*

I'm trying to load some strings from a database into a struct, but I keep running into an odd issue. Using my struct datum, struct datum { wchar_t* name; wchar_t* lore; }; I tried the following code snippet datum thisDatum; size_t…
0
votes
1 answer

Handle japanese characters on C++ using Marmalade SDK

I'm just starting to create a localization system using marmalade SDK that will needs to handle a Japanese characters. I'm currently using VS2010 to compile the project, and in my project I'm just created the following lines in order to handle a…
ganoncl
  • 1
  • 3
0
votes
2 answers

Retrieving VolumeDetails of WINDOWS Drives - stuck with 'char []' to 'LPCWSTR' conversion

I am trying to get the VolumeDetails of my WINDOWS system- Drive label plus its respective Volume Serial number. I've tried since an hour and built a code which gone wrong in syntax. At present I am getting the following error with it- error C2664:…
highlander141
  • 1,683
  • 3
  • 23
  • 48
0
votes
1 answer

Can't copy unicode(used wchar_t) in HTML format to clipboard

Copying to clipboard in HTML format works when I use char, but if I use wchar_t it doesn't work When I paste it it's just EMPTY here is my code Plase Help me Or is there a better way to use unicode(not using wchar_t)? If you do help me void…
asdf
  • 3
  • 1
0
votes
1 answer

compelling wchar_t to be 4 bytes

Practical question - I'm working on a little piece of app which runs on 2 separate hardware platforms. The compilation method and it's configuration is defined and controlled by me. My app receives a UTF-8/ISO-8859 text , and should perform some…
Yarel
  • 424
  • 1
  • 6
  • 15
0
votes
2 answers

Converting from wchar_t a char and vice versa

I am writing a template class String (just for learning purposes) and have a small problem. If T is wchar_t and U a char and vice versa, what am I missing for this method to work? template String operator + (const U* other) { …
Thunder
  • 611
  • 1
  • 8
  • 25
0
votes
1 answer

Issues when working with wide characters and the search.h library in C language

I've having trouble working with the search.h library, you see, the attribute "key" of the ENTRY struct is of type char, but I need to work with wchar_t : I have the following code: /* search for the word in the dictionary and return the last one…
richardtk_1
  • 751
  • 3
  • 11
  • 33
0
votes
1 answer

wchar_t could not be resolved

I am developing an Android application which uses JNI and native source code for the implementation. In my C source file I have a variable of the type of wchar_t*. The Eclipse compiler says that the type could not be resolved. I can't find a…
ssrp
  • 1,126
  • 5
  • 17
  • 35
0
votes
2 answers

How to replace character in TCHAR string

I have a TCHAR string which contains a path. I need to replace all occurences, if any, of / with \ in the path. The variable holding the path is defined as follows: TCHAR mypath[1024]; If mypath contains C:/new/newfile/a.txt, then I would need the…
SoDa
  • 71
  • 2
  • 8
0
votes
1 answer

How to make String to const wchar_t* conversion function work under Windows and Linux

I work on a project written for MSVCC / Windows, that I have to port to GCC / Linux. The Project has its own String Class, which stores its Data in a QString from Qt. For conversion to wchar_t* there was originally this method (for Windows): const…
weitho
  • 80
  • 1
  • 9