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
0
votes
1 answer

Cannot convert from 'WCHAR [256]' to 'WCHAR'

I have this function which uses the winscard.h function SCardGetReaderDeviceInstanceId. WCHAR SCardInstanceId(SCARDCONTEXT phContext, LPTSTR szReaderName) { WCHAR szDeviceInstanceId[256]; DWORD cchDeviceInstanceId = 256; long…
0
votes
1 answer

How to store text in wchar_t pointer parameter

I want to dll export some functions from cpp to dart and in order to do this I need to create a function with a pointer parameter where I will send text. But after many searches I found no solution that works. My question is: How to create a…
Doger
  • 141
  • 1
  • 8
0
votes
1 answer

wchar_t to std::string in hex format

I'm trying to convert a wchar_t to a hexadecimal and then convert it to std::string. Here is my code: #ifdef _DEBUG std::clog << wchar << std::endl; #endif wchar_t wideChar = printf("0x%x", wchar); #ifdef _DEBUG std::clog << wideChar…
anon
0
votes
1 answer

When to use _Notnull_ in C++?

Can someone provide insight when to use _Notnull_? I'm using Visual Studio 2019 and here is my code: #include #include void WriteIt(_Notnull_ CONST WCHAR* sMsg, _Notnull_ CONST WCHAR* sFileName) { FILE* stream; errno_t…
JeffR
  • 765
  • 2
  • 8
  • 23
0
votes
0 answers

Convert C++ UTF-8 literal to vector to uint32_t array[]

I must admit that my experience in coding C++ is very low, some few hundred lines. I solved the problem but I'm sure there is a better solution. At least I write this because I found no solutions via Google or stackoverflow, and other users maybe…
0
votes
3 answers

Effect of Wide Characters/ Strings on a C Program

Below is an excerpt from an old edition of the book Programming Windows by Charles Petzold There are, of course, certain disadvantages to using Unicode. First and foremost is that every string in your program will occupy twice as much space. In…
mindoverflow
  • 730
  • 4
  • 13
0
votes
1 answer

Printing a wchar_t as part of a wchar_t* string does not terminate

So, I found a bug in glibc that I like to report. The issue is that printf() counts the wrong width for a grouping character in the no_NO.utf8 locale and thus does not set aside enough padding to the left of the string. I originally spotted this in…
oligofren
  • 20,744
  • 16
  • 93
  • 180
0
votes
1 answer

Convert a multibyte UTF8 to wchar_t for usage with _wfopen()

There are different threads to similar problems, but after searching and trying a lot, I could not find a solution. So that's what I have: There is a pathname of a file which originally has the name "C:\F\鸡汤饭\abstr.txt". This is some internal…
Elmi
  • 5,899
  • 15
  • 72
  • 143
0
votes
2 answers

C programming language using locale.h to print UTF-8 characters

I want to print UTF-8 characters with C programming language. I've tried this but failed: #include #include #include #include int main(){ if(setlocale(LC_ALL, "zh-CN.UTF-8")!=NULL){ …
wjhtwx
  • 23
  • 4
0
votes
1 answer

How do i compare a given process name to a process name found from a snap shot?

if ((WCHAR*)procName == procEntry32.szExeFile) This is what I have, i've been told to use "strcmp" but it never seems to work. Could someone explain why? Or give me another solution? bool attachProc(char* procName) { PROCESSENTRY32…
0
votes
0 answers

getlength throwing error while using with wchar_t

I am working on a project that is written is VScode and is working properly. But when I am trying to execute the same on gn(generate ninja), this the error I am getting:- error: no member named 'GetLength' in 'std::basic_string
Vaibhav Angi
  • 57
  • 1
  • 4
0
votes
1 answer

Argument Type (WCHAR*) is incompatible with parameter of type "const char*)

This is part of some CSGO code and I don't know how to fix this problem; It's on line 8 of the snippet shown below: uintptr_t GetModuleBaseAddress(const char* modName) { HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE |…
0
votes
2 answers

Convert HEX MAC-Address to WCHAR Array in C/C++ on a WinCE 6 Device using wprintf()

The last days, I've been searching and reading through several dozens of questions on ere that sound similar to my problem, but I have not yet managed to get any solution to work. Consider the following, simple scenario: I am programming a C/C++-App…
derdomml
  • 43
  • 7
0
votes
0 answers

argument of type "WCHAR *" is incompatible with parameter of type "const char *"

I get this message and i dont know what to do. argument of type "WCHAR *" is incompatible with parameter of type "const char *" this is the code(it has a problem with the modEntry) uintptr_t GetModule(const char* modName, DWORD procId) { HANDLE…
0
votes
1 answer

Why WCHAR related code processing is needed

I came across an application code and see that for the "Windows" specific code they have converted the command line arguments to do some additional WCHAR related processing (between #ifdef _WIN32). What would be the reason for adding WCHAR…
user13003546