widechar Questions

8

Is there any reason why Java char primitive data type is 2 bytes unlike C which is 1 byte? Thanks
Johnsonjohnsonese asked 18/10, 2010 at 5:11

3

Solved

I'm trying to understand how does printf work with wide characters (wchar_t). I've made the following code samples : Sample 1 : #include <stdio.h> #include <stdlib.h> int main(void) { ...
Alcott asked 14/11, 2016 at 13:45

1

Solved

When I try to print the copyright symbol © with printf or write, it works just fine: #include <stdio.h> int main(void) { printf("©\n"); } #include <unistd.h> int main(void) { w...
Gunther asked 28/2, 2020 at 20:29

3

is there a way i can print __FUNCTION__ as a wide character on linux? the trick with the WIDEN doesn't work for me, the gcc compiler prints: error: ?L_FUNCTION_? was not declared in this scope ...
Farquhar asked 23/1, 2011 at 13:3

2

I'm aware that there is already a standard method by prefixing with L: wchar_t *test_literal = L"Test"; The problem is that wchar_t is not guaranteed to be 16-bits, but for my project, I need a ...

3

Solved

I'm trying to read a wide char from a stream that was created using fmemopen with a char *. char *s = "foo bar foo"; FILE *f = fmemopen(s,strlen(s),"r"); wchar_t c = getwc(f); getwc throws a se...
Wismar asked 10/8, 2017 at 22:12

1

If you feed a wchar_t, char16_t, or char32_t value to a narrow ostream, it will print the numeric value of the code point. #include <iostream> using std::cout; int main() { cout << 'x...
Defeat asked 12/12, 2016 at 18:58

1

Solved

The signedness of char is not standardized. Hence there are signed char and unsigned char types. Therefore functions which work with single character must use the argument type which can hold both ...
Docent asked 23/11, 2016 at 3:42

2

C++11 has tools to convert wide char strings std::wstring from/to utf8 representation: std::codecvt, std::codecvt_utf8, std::codecvt_utf8_utf16 etc. Which one is usable by Windows app to convert r...
Pneumoencephalogram asked 29/5, 2016 at 20:12

4

Solved

I have a template class in C++ which takes as a char_type template parameter the character type, such as char, wchar_t, char32_t, etc... The class then use std::basic_string<char_type> in the...
Yocum asked 29/9, 2015 at 9:22

1

Solved

I'm currently rewriting (a part of) the printf() function for a school project. Overall, we were required to reproduce the behaviour of the function with several flags, conversions, length modifier...
Twila asked 10/12, 2014 at 12:39

3

Consider this sample program: #include <cstdio> #include <cwchar> #include <string> int main() { std::string narrowstr = "narrow"; std::wstring widestr = L"wide&...
Doily asked 8/11, 2014 at 11:21

2

Solved

As I was writing a unit test, I stumbled upon some odd behavior from glibc, regarding "%p" and the NULL pointer. If I have a line such as printf("NULL pointer is %p\n", NULL);, then I see NULL poi...
Find asked 28/7, 2014 at 18:48

2

Solved

I have simple question here. How to convert WideChar to 2xByte in Delphi - 7? I searched the internet and the StackOverflow but with no results...
Cloots asked 13/3, 2013 at 14:31

2

Solved

I am in the process of making a small program that reads a file, that contains UTF-8 elements, char by char. After reading a char it compares it with a few other characters and if there is a match ...
Gabor asked 7/9, 2012 at 18:8

2

Solved

I came across this in the book: wscanf(L"%lf", &variable); where the first parameter is of type of wchar_t *. This s different from scanf("%lf", &variable); where the first parameter is...
Fini asked 2/7, 2012 at 2:27

2

Solved

I have a macro I use for debugging. #define diagnostic_arg(message,...) fprintf(stderr,message,__VA_ARGS__) I've found that I need to use wide-chars in my program, so I would like to change just...
Cadaver asked 21/3, 2012 at 21:18

2

I am developing a little application. The captions (text displayed on the Labels) with WideChars (Greek letters) are correct under Vista and Windows7 in almost every case, but in some cases (on som...
France asked 22/11, 2011 at 22:23

5

Solved

What is the difference between WideCharToMultiByte() and wcstombs() When to use which one?
Ragged asked 11/4, 2011 at 11:51

2

Solved

I'm upgrading some ancient (from 2003) Delphi code to Delphi Architect XE and I'm running into a few problems. I am getting a number of errors where there are incompatible types. These errors don't...
Dougie asked 8/2, 2011 at 23:47

4

Solved

I'm not quite pro with encodings, but here's what I think I know (though it may be wrong): ASCII is a 7-bit, fixed-length encoding, with the characters you can find in ASCII charts. UTF8 is an 8-...
Defazio asked 4/1, 2011 at 9:45

2

I have UNICODE application where in we use _T(x) which is defined as follows. #if defined(_UNICODE) #define _T(x) L ##x #else #define _T(x) x #endif I understand that L gets defined to wchar_t, ...
Stilt asked 9/11, 2010 at 11:29

1

Solved

My code is basically this: wstring japan = L"日本"; wstring message = L"Welcome! Japan is "; message += japan; wprintf(message.c_str()); I'm wishing to use wide strings but I do not know how the...
Oswell asked 28/6, 2010 at 6:13

4

Solved

I need to put WCHAR[] to std::cout ... It is a part of PWLAN_CONNECTION_NOTIFICATION_DATA passed from Native Wifi API callback. I tried simply std::cout << var; but it prints out the numeri...
Tremolo asked 26/10, 2009 at 15:39
1

© 2022 - 2024 — McMap. All rights reserved.