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

NSString initWithBytes returns nil when given wchar_t array containing Chinese characters

I've got a custom C++ string class in my iOS app that is based on an array of wchar_t. I have a method to convert it to NSString that looks like this: NSString *str = [[[NSString alloc]initWithBytes:(const void *)mArray length:sizeof(wchar_t)…
Tom Hamming
  • 10,577
  • 11
  • 71
  • 145
0
votes
2 answers

Replacing backslash with double backslash or forward slash in LPSTR filepath

I am trying to post a message to the WIN32 API to open a WAV File. I can do this by setting the LPARAM parameter to L"C:/path/file.wav" This works excelent! However, I have been trying to use a dialogbox to generate a string to a filepath. The…
Alex van Rijs
  • 803
  • 5
  • 17
  • 39
0
votes
1 answer

vswprintf : Mac %s vs Windows %S

I'm using vswprintf to form a wchar_t* str from a formatted string. In that formatted string, to print a std:string, Mac accepts as %s while Windows VS2008 accepts as %S. Example void widePrint(const wchar_t* fmt, ...) { va_list args; …
0
votes
1 answer

Getting dll path / string issue (C++ beginner)

I have a self registering COM visible dll (C++) installed in a folder in Program Files along with an appref-ms file that points at a click once application. The purpose of this dll is to allow the click once app to be launched from the right click…
Coder1095
  • 828
  • 10
  • 25
0
votes
1 answer

Qt cannot convert 'const wchar_t*' to 'TCHAR*'

I transfer the project from visual studio to QT and when the project build - displayed errors. How to fix them without making significant changes in the code?. cannot convert 'const wchar_t*' to 'TCHAR*' cannot convert '_TCHAR*' to 'const…
Dmitriy
  • 161
  • 2
  • 12
0
votes
1 answer

mysql_query and embarcadero c++

I use MySQL C API with Embacadero c++ without any problems in (ANSI). But when I try to send any wide character (UNICODE) like Arabic symbols, appears as not readable characters (garbage) in MySQL database. Because the SQL string that I send it by…
0
votes
1 answer

Get C++ wchar_t into Flash, via Lua

I am currently working on an application in C++, that ties into Lua, that ties into Flash (in that order). My goal at the moment is getting wchar_ts from C++ into Flash, via Lua. I would love any insights as to how I can accomplish this! If any…
Jace
  • 3,052
  • 2
  • 22
  • 33
0
votes
1 answer

convert wchar_t to char c++

I use mingw compiler. How to convert wchar_t to char ? Data(HWND hwnd, wchar_t szFileName[MAX_PATH]) { string sIn; ifstream infile; infile.open(szFileName); infile.seekg(0,ios::beg); // fill vector with file rows while (…
Carl Mark
  • 371
  • 1
  • 12
  • 23
0
votes
3 answers

Trying to figure out the following disassembly listing

I am looking at the following disassembly for a Win32 executable in IDA pro and get the snwprintf part but I don't understand the purpose of the mov ecx, [eax+4] instruction here (are they discarding part of the string here?). loc_4018E7: mov …
Bootstrapper
  • 1,089
  • 3
  • 14
  • 33
0
votes
2 answers

Weird symbol in wchar_t char array

What is causing this weird symbol occurring at the beginning of the array? It occurs with Unicode character and Multibyte character sets. It's stopping me from being able to compare it to another array. Edit: Google gave me nothing when…
prototypik
  • 2,726
  • 1
  • 18
  • 21
0
votes
3 answers

C++ wchar_t array to pointer and in function usage

I had the following code: wchar_t recordsText[64] = L"Records: "; std::wstringstream ss2; ss2 << c; wcsncat_s(recordsText, ss2.str().c_str(), sizeof(ss2.str().c_str())); ((CButton*)GetDlgItem(IDC_RECORDS))->SetWindowTextW(recordsText); It worked…
Laokoon
  • 1,241
  • 4
  • 24
  • 47
0
votes
2 answers

C++ wchar_t * equals case-insensitive to other wchar_t *

Im trying to check if a wchar_t * equals case-insensitive to another wchar_t *. Can someone put me in the right way? There is what I tryed: wchar_t *vectored[80] = { ... }; int i = 0; int j = 1; _Towlower(vectored[i], NULL) == _Towlower(vectored[j],…
Marcos Eusebi
  • 617
  • 7
  • 17
0
votes
3 answers

wchar_t to a PHP UTF8 File

i wrote a php script which recieves http POST packages from a windows-client-software. the windows client uses the "WinHttpClient" for C++. the WinHttpClient takes the messages i send as wchar_t. the problem now is, i recieve the messages on my PHP…
Laokoon
  • 1,241
  • 4
  • 24
  • 47
0
votes
1 answer

How to copy wide string in VC++ 2003

Hi could you please help us in copying one wchar_t* to another wchar_t*. I'm using the following code: wchar_t* str1=L"sreeni"; wchar_t* str2; wcscpy(str2,str1); In the last line I'm getting a run time error as without allocating memory to…
0
votes
1 answer

Issue in Converting wchar_t* to char*

I need to read the current directory in Windows 7 which is in a different locale than the one that is currently used. So I thought of using GetCurrentDirectoryW() since it is unicode compatible, with wchar_t*. However, I need to use an existing API,…
Izza
  • 2,389
  • 8
  • 38
  • 60