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
1
vote
2 answers

Issue with Int to LPWSTR function

I am making a win32 program that is a level editing tool to go with the library I am creating for a 2D tile system. I want to create dialog box displaying the maps properties when the user selects it from the menu. This means a conversion from int…
David Kimbrey
  • 119
  • 2
  • 8
1
vote
1 answer

Dynamic wchar_t array (C++ beginner)

I am modifying some C++ code that has a wchar_t myArray[MAX_PATH] in the header file. My modifications mean that I cannot know the length of this array until runtime. How can I store an array of dynamic length instead? Maybe I just keep a wchar_t*…
Coder1095
  • 828
  • 10
  • 25
1
vote
4 answers

C++, WCHAR[] to std::cout and comparision

I need to put WCHAR[] to std::cout ... It is a part of PWLAN_CONNECTION_NOTIFICATION_DATA passed from Native Wifi API callback. I tried simply std::cout << var; but it prints out the numeric address of first char. the comparision (var == L"some…
migajek
  • 8,524
  • 15
  • 77
  • 116
1
vote
2 answers

setlocale() doesn't work in iOS simulator?

Update: Strangely, setlocale() only fails on the iOS Simulator so I have amended the question title. It works fine on actual devices. I'm working with native (C/C++) code under iOS 6 and I need to format arbitrary wchar_t strings. However, when…
Xaxx
  • 127
  • 11
1
vote
2 answers

C++ splitting unicode delimited string using wstring

I am trying to accomplish the subject task but my code doesnt split. Here is the main function: #define SQL_TEXT Latin_Text #include #define SQL_TEXT Latin_Text #include #include "Split.h" #include #include…
Zeeshan Arif
  • 467
  • 4
  • 14
1
vote
1 answer

Display wchar_t using ncurses

i'm currently working on a C++ project in which I need to display some extended characters (wchar_t). The main problem is that, even if it works fine in C (using wprintf), it doesn't work in c++ using mvwaddwstr or waddwstr. Of course, i've set the…
GeoffreyB
  • 1,791
  • 4
  • 20
  • 36
1
vote
1 answer

Invalid localized chars in a text file

I learn the C language. I need to create some text file with Unicode data. I have wrote such code: #include #include #include int main(int argc, char *argv[]) { wchar_t *s1 = L"Привет, мир!\n"; wchar_t *s2 =…
Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
1
vote
1 answer

Is there a way to use _T/TEXT "conditionally" inside a macro?

This question is specific to Visual C++ (you may assume Visual C++ 2005 and later). I would like to create glue code for a program from unixoid systems (FreeBSD in particular) in order build and run on Win32 with a minimum of changes to the original…
0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
1
vote
2 answers

Cannot create new wchar_t *

I have this operator overloader. My program crashes at the creation of the new wchar_t array. myObject &operator += (const myObject &s) { wchar_t *cat = wcscat(data, s.data); int len = wcslen(cat); wchar_t *test = new wchar_t[len + 1];…
HansElsen
  • 1,639
  • 5
  • 27
  • 47
1
vote
3 answers

Non-ASCII wchar_t literals under LLVM

I've migrated an Xcode iOS project from Xcode 3.2.6 to 4.2. Now I'm getting warnings when I try to initialize a wchar_t with a literal with a non-ASCII character: wchar_t c1; if(c1 <= L'я') //That's Cyrillic "ya" The messages…
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
1
vote
0 answers

Assigning CORBA::WChar* to wchar_t* and sth more

I know I recently created similar topic but now my question is a little bit different. Is it legal to do this: 1) CORBA::WString_var value; const ::CORBA::WChar* v = L"ąśżźćłóń"; value = CORBA::wstring_dup(value); 2) class WCharStuff { …
mazix
  • 2,540
  • 8
  • 39
  • 56
1
vote
1 answer

unresolved external symbol while using wchar_t in managed c++ project

I have one C++ project with settings of Unicode as character set and /clr option for common language run time support. I am calling some function of MFC dll (with setting of MultiByte character set) and I am getting some liking error on those…
1
vote
3 answers

Reading from file containg utf-8(HINDI) format text and writing to anther file

I am trying to read characters from a file and after removing punctuations. I want to store the words in an array and finally write them to another file. The contents of the file are :- "यौ ता बाबू उदयभाहू उपेक्षा औंर अपमान्नकीपीड््ा ढोये…
Aditya Ray
  • 13
  • 4
1
vote
1 answer

Conversion between char and wchar_t in NDK

Assume: char from[10]="abcd"; wchar_t to[10]=L""; In gcc under Linux and MSVC, I can use: sscanf(from, "%S", to); to get a wchar_t string L"abcd" in to. But this does not work in NDK. I want to know whether this is supported in NDK? Is there any…
fefe
  • 3,342
  • 2
  • 23
  • 45
1
vote
1 answer

What is the cause of the warning: implicit declaration of function 'swprintf_s'?

I am wondering why my use of swprintf_s is generating the linker warning warning: implicit declaration of function 'swprintf_s' I have this headers: #include #include #include #include #include…
Jack
  • 16,276
  • 55
  • 159
  • 284