Questions tagged [wchar]

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 is included to perform input and output operations on wide streams. It can also be used to manipulate the wide strings.

196 questions
4
votes
1 answer

C++ Processentry32

please help. PROCESSENTRY32 entry; if (!strcmp(entry.szExeFile, process)) Error on entry: Argument of type WCHAR* is incompatible with parametr of type const char* Please dont hate me, I am beginer. Thanks for helping ;)
Dortík
  • 167
  • 1
  • 7
4
votes
0 answers

Print a wchar_t emoji on console with wcout in C++ strange behavior

I am trying to print an emoji on standard output console in C++ on Mac OS X environment – clang. This first code works correctly: #include #include int main(int argc, const char *argv[]){ char myEmoji[4] = "⛩"; std::cout <<…
shogitai
  • 1,823
  • 1
  • 23
  • 50
4
votes
3 answers

C++ regex with char and wchar_t?

I have a const char and a const wchar_t. My function below works with the char. What's the simplest/most efficient way to write a function that can easily handle both char and wchar_t? const char* asciiChar = "this is an ascii string"; …
fxfuture
  • 1,910
  • 3
  • 26
  • 40
4
votes
2 answers

converting or casting LPWST into BSTR

How to convert LPWSTR into BSTR ? LPWSTR is WCHAR * and BSTR is OLECHAR *, OLECHAR is again of type WCHAR, simply type casting will work ? or we need to do some extra effort ? It is showing bad conversion error/warning.
Anand
  • 67
  • 4
  • 9
4
votes
4 answers

Convert WCHAR[260] to std::string

I have gotten a WCHAR[MAX_PATH] from (PROCESSENTRY32) pe32.szExeFile on Windows. The following do not work: std::string s; s = pe32.szExeFile; // compile error. cast (const char*) doesnt work either and std::string s; char DefChar = '…
user1334943
  • 127
  • 1
  • 1
  • 10
3
votes
3 answers

How to concat an int to a wchar_t* in C++?

I have to create and write on N files, everyone must have an integer ending to identificate it. This is my piece of code: for(int i=0; i
DavideChicco.it
  • 3,318
  • 13
  • 56
  • 84
3
votes
3 answers

Why do my Win32 API calls require the 'A' suffix and should I rectify that?

To execute a command from the Win shell I needed ShellExecuteA(NULL, "open", "http://stackoverflow.com", NULL, NULL, SW_SHOWNORMAL); and now I am working through Forgers Win32 Tutorial I am finding the A suffix necessary to prevent printing garbage…
John
  • 6,433
  • 7
  • 47
  • 82
3
votes
1 answer

Ncurses not writing out the specified number of wide characters (about column needs of a wide character)

In the program below I am attempting to use ncurses to output ten rows of ten Unicode characters each. Each iteration of the loop chooses one random character from an array of three Unicode characters. However the problem that I'm encountering is…
3
votes
2 answers

Pass a function pointer from C++ to be called by C# - Arguments of functions include a wide char string (LPCWSTR)

I am writing a C# library to be used by native C++ application. I am using C++/CLI as the Interoperability mechanisim. I require to pass a callback function from C++ to C# (using C++/CLI as the intermediate layer). C# library needs to call the C++…
Anil Padia
  • 513
  • 1
  • 6
  • 12
3
votes
1 answer

Multi-Byte UTF-8 in Arrays in C++

I have been having trouble working with 3-byte Unicode UTF-8 characters in arrays. When they are in char arrays I get multi-character character constant and implicit constant conversion warnings, but when I use wchar_t arrays, wcout returns nothing…
2
votes
2 answers

'strcpy' : cannot convert parameter 2 from 'WCHAR *' to 'const char *

Having some issues with strcpy... Getting this error: strcpy' : cannot convert parameter 2 from 'WCHAR *' to 'const char * Here is the code... char FunctionName[ 256 ]; UFunction *pUFunc = NULL; strcpy( FunctionName,…
E3pO
  • 493
  • 1
  • 9
  • 21
2
votes
3 answers

wprintf UTF16 (should be UTF8) on Linux?

1 It's really strange that wprintf show 'Ω' as 3A9 (UTF16), but wctomb convert wchar to CEA9 (UTF8), my locale is default en_US.utf8. As man-pages said, they should comform to my locale, but wpritnf use UTF16, why? excerpt from…
davy
  • 123
  • 1
  • 3
  • 8
2
votes
1 answer

Setting the szTip field of the NOTIFYICONDATA structure

The szTip field is 128 characters long, and unicode. It is of type TCHAR, which is typedef'd as WCHAR. So i have no clue why the following code snippet will not compile. nid.szTip = _T("ToolTip"); The compile error is error C2440: '=' : cannot…
Steve Barna
  • 1,378
  • 3
  • 13
  • 23
2
votes
1 answer

'fatal error: 'wchar.h' file not found' error with the new macos 11.3 update

I'm totally new to c++ (just started learning from scratch yersterday). Today I had this macos update to 11.3 and now when I run my c++ code in clion I get this error, ====================[ Build | untitled | Debug…
Nibin
  • 97
  • 10
2
votes
1 answer

Trouble printing DIDEVICEINSTANCE tszProductName to Windows Console

I've been following a DirectInput tutorial and am having trouble printing a list of DirectInput device product names to a Windows console. I'm using VS19's C++ compiler and am compiling with UNICODE defined. Since tszProductName is of type TCHAR…
Sencillo
  • 21
  • 1
1 2
3
13 14