widestring

Can we use wmain() functions with Unix compilers or it'll work only on windows?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 08:20:43
问题 Can we use wmain() functions with Unix compilers or it'll work only on\for windows? 回答1: The only standard signatures for main are: int main(void); int main(int argc, char *argv[]); However, a freestanding implementation can provide extensions/allow other signatures. But those are not guranteed to be portable. wmain looks like a Windows/VS thing. There's not much chance this will work on a *nix/GNU GCC. 回答2: The wmain signature exists in Windows to handle wide-character command line arguments

Is it necessary to convert string to WideString in Delphi?

梦想与她 提交于 2019-11-30 06:45:29
I found a Windows API function that performs "natural comparison" of strings. It is defined as follows: int StrCmpLogicalW( LPCWSTR psz1, LPCWSTR psz2 ); To use it in Delphi, I declared it this way: interface function StrCmpLogicalW(psz1, psz2: PWideChar): integer; stdcall; implementation function StrCmpLogicalW; external 'shlwapi.dll' name 'StrCmpLogicalW'; Because it compares Unicode strings, I'm not sure how to call it when I want to compare ANSI strings. It seems to be enough to cast strings to WideString and then to PWideChar, however, I have no idea whether this approach is correct:

C++: wide characters outputting incorrectly?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 15:14:04
问题 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 they're outputted, so I used wprintf. When I run something such as: ./widestr | hexdump The hexidecimal codepoints create this: 65 57 63 6c 6d 6f 21 65 4a 20 70 61 6e 61 69 20 20 73 3f 3f e W c l m o ! e J p a n a i s ? ? Why are they all jumped in order? I mean if the wprintf is wrong I still don't get why

Can we use wmain() functions with Unix compilers or it'll work only on windows?

断了今生、忘了曾经 提交于 2019-11-29 06:33:49
Can we use wmain() functions with Unix compilers or it'll work only on\for windows? The only standard signatures for main are: int main(void); int main(int argc, char *argv[]); However, a freestanding implementation can provide extensions/allow other signatures. But those are not guranteed to be portable. wmain looks like a Windows/VS thing. There's not much chance this will work on a *nix/GNU GCC. The wmain signature exists in Windows to handle wide-character command line arguments. Generally, while Windows applications prefer UTF16, Unix applications prefer UTF8 for Unicode string encoding.

Why can Delphi DLLs use WideString without using ShareMem?

怎甘沉沦 提交于 2019-11-27 04:30:55
David's answer to another question shows a Delphi DLL function returning a WideString. I never thought that was possible without the use of ShareMem . My test DLL: function SomeFunction1: Widestring; stdcall; begin Result := 'Hello'; end; function SomeFunction2(var OutVar: Widestring): BOOL; stdcall; begin OutVar := 'Hello'; Result := True; end; My caller program: function SomeFunction1: WideString; stdcall; external 'Test.dll'; function SomeFunction2(var OutVar: Widestring): BOOL; stdcall; external 'Test.dll'; procedure TForm1.Button1Click(Sender: TObject); var W: WideString; begin

What exactly is the L prefix in C++?

做~自己de王妃 提交于 2019-11-26 17:37:47
I understand what it does: specifies a string literal as a const wchar_t * (wide character string) instead of const char * (plain old characters), but how is it actually defined? Is it a macro of some sort? Is it an operator for GCC compilers? What is it? Kerrek SB The literal prefixes are a part of the core language, much like the suffixes: 'a' // type: char L'a' // type: wchar_t "a" // type: char[2] L"a" // type: wchar_t[2] U"a" // type: char32_t[2] 1 // type: int 1U // type: unsigned int 0.5 // type: double 0.5f // type: float 0.5L // type: long double Note that wchar_t has nothing to do

Why can Delphi DLLs use WideString without using ShareMem?

不羁的心 提交于 2019-11-26 11:13:22
问题 David\'s answer to another question shows a Delphi DLL function returning a WideString. I never thought that was possible without the use of ShareMem . My test DLL: function SomeFunction1: Widestring; stdcall; begin Result := \'Hello\'; end; function SomeFunction2(var OutVar: Widestring): BOOL; stdcall; begin OutVar := \'Hello\'; Result := True; end; My caller program: function SomeFunction1: WideString; stdcall; external \'Test.dll\'; function SomeFunction2(var OutVar: Widestring): BOOL;

What exactly is the L prefix in C++?

巧了我就是萌 提交于 2019-11-26 06:06:59
问题 I understand what it does: specifies a string literal as a const wchar_t * (wide character string) instead of const char * (plain old characters), but how is it actually defined? Is it a macro of some sort? Is it an operator for GCC compilers? What is it? 回答1: The literal prefixes are a part of the core language, much like the suffixes: 'a' // type: char L'a' // type: wchar_t "a" // type: char[2] L"a" // type: wchar_t[2] U"a" // type: char32_t[2] 1 // type: int 1U // type: unsigned int 0.5 //