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
2
votes
1 answer
Custom String Literals
Out of curiosity, I was wondering how different files are able to assign certain symbols to change they regular c-string literals into other literals.
For Example...
In Objective-C, the NSString literal can be written by @"..."
In C++ (I think), the…

Chase Walden
- 1,252
- 1
- 14
- 31
1
vote
2 answers
C++ - How to store a Chinese character in a char or similar?
I am trying to store a Chinese character in a variable of type wchar_t and print out this character. However, the program incorrectly prints a ?. Here is my code.
#include
int main() {
using std::wcout;
using std::endl;
…

Danhui Xu
- 69
- 10
1
vote
1 answer
Visual studio 19 reads char as wide (unicode)
My issue is that visual studio is reading char as as a wide char.
char newChar ;
ReadProcessMemory(handle, (LPCVOID)(baseAddr), &newChar, 1, NULL);
std::cout << "Read char: "<

Max K
- 41
- 4
1
vote
1 answer
Convert const char* to UTF16 from C on macOS and Windows?
My attempts seem hacky and overly convoluted. Is there a simple way to convert ASCII to UTF16 on Windows and macOS?
(note that the prUTF16Char I can't change )
Attempt (written via https://stackoverflow.com/a/54376330)
Prelude
#include…

Samuel Marks
- 1,611
- 1
- 20
- 25
1
vote
3 answers
Duplicating wide-character string
I am trying to create an application in which I have a function where I am trying to duplicate a wide character string. I am currently using _wcsdup(), since it is a Windows application and everything is working fine for me. But I need to create a…

Rohit Nagpal
- 79
- 8
1
vote
2 answers
Data Structure to use instead of hash_map
I want to make an array containing three wide character arrays such that one of them is the key.
"LPWCH,LPWCH,LPWCH" was not able to use the greater than/lesser than symbols since it thinks it is a tag
Hash_map only lets me use a pair. wKey and the…

roymustang86
- 8,054
- 22
- 70
- 101
1
vote
2 answers
What is TCHAR and how does it differ from WCHAR?
This question should've had an answer nowadays here, but there is nothing explaining what exactly TCHAR is on stackoverflow (all I found is an explanation of the difference between TCHAR and _TCHAR).
All I know is that TCHAR and _TCHAR are…

Kaiyaha
- 448
- 3
- 9
1
vote
0 answers
/usr/local/Cellar/gcc/10.1.0/include/c++/10.1.0/cwchar:44:10: fatal error: wchar.h: No such file or directory
I'm trying to compile the c++ file and it's throwing error that wchar is not present
/usr/local/Cellar/gcc/10.1.0/include/c++/10.1.0/cwchar:44:10: fatal error: wchar.h: No such file or directory

AMANDEEP THAKUR
- 11
- 2
1
vote
1 answer
C++ Argument of type "const wchar_t" * incompatible with parameter of type "wchar_t"
Сan't call "GetProcessByExeName"
DWORD GetProcessByExeName(wchar_t* ExeName)
{
PROCESSENTRY32W pe32;
pe32.dwSize = sizeof(PROCESSENTRY32W);
HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
if (hProcessSnap ==…

danrom11
- 27
- 6
1
vote
1 answer
Can't print char* in WCHAR* with swprintf
I have that function that work (I just have to turn wstring to WHAR* at the end):
wstring stringtowstring(string str)
{
WCHAR ch[256];
MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, (LPWSTR)ch, 256);
return wstring(ch);
}
But I would…

Entretoize
- 2,124
- 3
- 23
- 44
1
vote
2 answers
C/C++ printing UK pound symbol from wint_t
I am on a Linux system and set the keyboard setting to UK in order to capture and print out a UK pound symbol (£).
Here is my code:
#include
#include
#include
int main ()
{
wint_t wc;
fputws (L"Enter text:\n",…

Ankur Shah
- 125
- 12
1
vote
2 answers
How can I copy a CHAR Variable to WCHAR Variable in C++
I want to convert a CHAR file to UNICODE file.
I read a file character by character in CHAR file type and then save this character in a CHAR Variable and then I want to copy this CHAR Variable to a WCHAR Variable and then I Write the the WCHAR…

Behzad
- 1,740
- 1
- 22
- 49
1
vote
2 answers
OCI,OCILIB,ODBC wide character(wchar) support
Which of these libraries OCI,OCILIB,ODBC or any other support wide character strings (wchar) ?

Greenhorn
- 658
- 2
- 8
- 24
1
vote
1 answer
adding crlf to WCHAR * in VC++ 2005
this is VC++ 2005:
How can I append a WCHAR * "firstText" and another WCHAR * "secondText" into another WCHAR * "thirdText" with a CRLF "\r\n" between them?
WCHAR firstText [100] = L"First line";
WCHAR secondText [100] = L"Second line";
WCHAR…

Abe000
- 13
- 7
1
vote
1 answer
How to convert Unicode string to a TCHAR system?
I have a python (3.6) code that should pass a Unicode string to an Unreal Engine project. The Unreal Engine displays text in TEXT format which I'm not wrong is an array of Win-Api's TCHARs. I saw that on my platform the TCHAR is 2 bytes.
Here is how…

Elad Weiss
- 3,662
- 3
- 22
- 50