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
0
votes
1 answer
Extension issue for renamed file for FIle Reading in C / C++
I have a code for reading the header of a csv file. First I check whether the extenson is .csv or not. Then I read the file. But the problem is, if I rename any other file, say a .xml file or a .docx file to .csv and then try to read it, then this…

sudiptaasi
- 11
- 1
0
votes
0 answers
Using ICU's UChar as a replacement for wchar?
Since I heard there are many problems with the wchar_t type (compiler-specific width), I was very interested by the International Components for Unicode project.
But, ICU seems a bit heavier for my needs.
I only need something that could provide an…

Punkfloyd
- 45
- 4
0
votes
2 answers
Conversion between wchar_t char in ANSI Code Page
If I am in the ANSI codepage only environment.
Does this conversion wide char to char:
char ansi_cstr[size_of_ansi_str];
WideCharToMultiByte(CP_ACP, 0, ansi_wstr.c_str(), -1, ansi_str, size_of_ansi_str, 0, 0);
std::string ansi_str =…

Chen OT
- 3,486
- 2
- 24
- 46
0
votes
1 answer
Transform any signed char type into an unsigned one
template< typename charT >
struct serializer
{
/* ... */
private:
std::basic_string< charT > base64_encode( unsigned charT * bytes, unsigned length );
};
I would like the private member function to take an unsigned whatever-char-type. If…

qdii
- 12,505
- 10
- 59
- 116
0
votes
1 answer
Testing for ascii characters whose value is > 127 in C
I have some data like this:
2s ²S 1/2 0
2p ²P° 1/2 160015
3/2 163990
3s ²S 1/2 1682700
3p ²P° 1/2 1726520
3/2 1727830
3d ²D 3/2 1743500
5/2 1743890
4s ²S 1/2 2252600
4p ²P° 3/2 2270150
1/2 2270150
4d ²D …

Mannix
- 411
- 10
- 23
0
votes
1 answer
Converting char to wchar_t with less modification
Currently my project does not support UNICODE. I want to make it to convert all the char to wchar_t.
My project has the mix of both char and wchar_t.
Basically one class I needed now to modify its arguments which is leading to more changes.
Kindly…

user1581317
- 53
- 6
0
votes
4 answers
undo escape sequence "\" before unicode char
I use a console program (cmd call) for translating a string from the standard input into a string in special Unicode characters, received from the standard output. The returning string in C# escapes the escaping backslash before the Unicode…

Jens Bornschein
- 163
- 2
- 11
0
votes
1 answer
wchar implementation of a simple Caesar cipher in C
I am writing a simple Caesar implementation for Amharic- one of the languages widely spoken in Ethiopia. Here is the code
main(){
setlocale(LC_ALL, " ");
int i, key=0;
wchar_t message[20];
wprintf(L"Enter…

Tadele T
- 13
- 4
0
votes
1 answer
Dynamically creating "LPCWSTR" variable from std::string variable
Currently I have the code (typedef _Null_terminated_ CONST WCHAR *LPCWSTR;):
LPCWSTR wchar_string(L"ABC");
But need to enable something like this:
std::string s("ABC");
...
LPCWSTR wchar_string(/* create somehow from variable s */);

Oleg Shirokikh
- 3,447
- 4
- 33
- 61
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
2 answers
Convert WCHAR * to UNICODE STRING
First try at windows driver development.
How can I convert a WCHAR array (coming from user-space) to a UNICODE_STRING (in kernel mode) assuming that the WCHAR array is not null-terminated?
Should I verify if it ends with null and if it doesn't…

user1782427
- 770
- 1
- 8
- 19
0
votes
2 answers
What is the easiest way to convert a char array to a WCHAR array?
In my code, I receive a const char array like the following:
const char * myString = someFunction();
Now I want to postprocess it as a wchar array since the functions I use afterwards don't handle narrow strings.
What is the easiest way to…

Etan
- 17,014
- 17
- 89
- 148
0
votes
1 answer
error when use array wchar
I have a variable with type wchar (szDrive), now i want to have a array and element of it has type wchar.
Here is some my code:
typedef struct array_wchar{
WCHAR array_char[5];
};
array_wchar array_driveName0[10];
int array_driveName_index0…

Cuong
- 24
- 3
0
votes
1 answer
wcslen returns bad length when using -fshort-wchar
Source code:
const wchar_t* x = L"abc";
printf("%d\n",wcslen(x));
I compiled this with g++ -fshort-wchar xxx.cpp -o xxx, and I get 15 as the result. Why?

bill wang
- 23
- 4
0
votes
1 answer
Looping through an Array Pointer?
I'm not very experienced with C++, and I was reading through some code and wanted to know how this made sense...
WCHAR *Process[128];
for(i=0; i

JimmySmithJR
- 301
- 1
- 9
- 17