wchar.h is a header file in the C standard library. It is a part of the extension to the C programming language standard done in 1995. It contains extended multibyte and wide character utilities. The standard header
Questions tagged [wchar]
196 questions
-1
votes
1 answer
Using wstring and wcout doesn't get the expected output
I'm writing a program in C++ which have to handle unicode characters.
The main problem is I use algorithms where I need to parse my s/wstrings char by char :
std::wstring word = L"Héllo"
for (auto &e : word)
// doing something with e
But if I run…

LightMan
- 53
- 1
- 8
-1
votes
2 answers
C++ pass by reference WCHAR** into a function
I have written following code where I am passing a WCHAR** reference to a function in order to get it filed inside the function. Inside the function, I am filling this 2 dimensional array. I am trying to use pass by reference to get this done.
BOOL…

KItis
- 5,476
- 19
- 64
- 112
-1
votes
1 answer
Problems with wchar* and printing it C
I have a problem, sometimes in the end of string I get many ????????? I don't know how to fix this, not to get that garbage. . .
USHORT length = (USHORT)d.GetLength();
if (length == 0) {
cEncodeJsonUtil->AddElement(dataHeader, L"null",…

Vess
- 249
- 1
- 3
- 10
-1
votes
1 answer
Getting WCHAR array to std::string in unicode?
I'm doing on a win32 application, and has a edit control that accepts unicode text input. I use the following code to get the text to a std::string:
WCHAR out[50] = {};
GetDlgItemTextW(hwnd, ID_Edit, out, 50);
wstring myWString(out);
string…

Dia
- 851
- 1
- 15
- 35
-1
votes
1 answer
How do I widen a char in c++
I'm writing a game in c++ using SFML, I found a font that support French characters. However, in the program I read all the text from files to be able to support different languages, but I don't know how to extract the text without errors into a…

Ingy
- 1
-1
votes
1 answer
TCHAR, WCHAR, LPWSTR, LPSTR, wstring clarification
Hello everybody and good afternoon. So I'm still new-ish to this scene but have quite the ambition for it and I've been trying to learn as much as i can. i consider myself to be adept in c++ but I've always programming DOS programs and recently I've…

Pr Erkle
- 29
- 1
- 4
-1
votes
1 answer
mysql connector c++ convert string to wchar
how can I convert a std::string (result from mysql select query)
to WCHAR?
already tryed this:
(wchar_t)app->db->getString("CharName")
but I get error
no suitable conversation from std::string to wchar_t exists

user3742380
- 13
- 4
-1
votes
1 answer
Converting wchar to string and push in a vector (C/C++)
I just want to convert my wchar array to a string and push it in my string vector. My solutions are commented out because it doesn't work. I get an error that my vector is overloaded.
Code is below:
vector vec;
string tmp;
int n;
…

Kipcak08
- 313
- 2
- 4
- 13
-2
votes
2 answers
How can I convert CString to WCHAR* and std::string to WCHAR* in C++, not wchar_t*
I want to convert CString to WCHAR* or std::string to WCHAR* in Visual Studio C++ MFC Application. I found in stackoverflow that it only has the solution for convert to wchar_t*.
Please help me. Thank you!

Noob
- 23
- 3
-2
votes
2 answers
How to return a WCHAR ** parameter with std::vector?
I have a function that sets one of the parameters to outgoing. I need to use it with std::vector.
Here is the function that returns the filename into *sFilename that is declared as WCHAR **:
BOOL GetFilenameFromPathAndFilename(WCHAR…

JeffR
- 765
- 2
- 8
- 23
-2
votes
1 answer
Win32 API Visual C++ ReadFile() function generates gibberish if second parameter is LPWSTR
I was trying to make a very basic text editor with Win32 that has the ability to read files and change the text of an edit control to it. I want it to be able to handle chars in all languages, so I tried to use a LPWSTR for the second parameter of…

Tyler Tian
- 597
- 1
- 6
- 22
-2
votes
1 answer
std::wstring Is converting first character randomly
I've got this piece of code:
const char * c = &(4:); //This pointer contains "JPG" string
//Wide char conversion
wchar_t *cc = new wchar_t[128];
MultiByteToWideChar(CP_ACP, 0, c, -1, cc, wcslen(cc));
Then I declare a wstring variable:
wstring…

ProtectedVoid
- 1,293
- 3
- 17
- 42
-2
votes
2 answers
Wide character output result
Why do I get numbers as output result when using wchar_t?
#include
using namespace std;
int main()
{
wchar_t q;
q = 'A';
cout << q;
q = 'B';
cout << q;
q = 'C';
cout << q;
return 0;
}

user1888353
- 49
- 5
-2
votes
2 answers
Conversion from UTF-8 to ANSI wcstombs failes at one spezial character
I want to change a wchar_t* like it is displayed to a char*.
No conversions like in the WideCharToMultibyte should be done.
I found the wcstombs function and it looked like it works perfectly, but there is one char which does not get changed…

Ich
- 1
- 1
-3
votes
1 answer
Sorting function not working (string comparison issue)
I've got a sorting function which should put all usernames starting from 3 character or more to the top of the array, and all the ones under 3
if(wcslen((WCHAR*)playerNames[i]) < 3)
(Which will all be "-") to the bottom and replaced with…

Hx0
- 309
- 3
- 9