November 26, 2015 Re: Something about Chinese Disorder Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Wednesday, 25 November 2015 at 12:33:00 UTC, Marc Schütz wrote: > On Wednesday, 25 November 2015 at 04:09:29 UTC, magicdmer wrote: >> On Tuesday, 24 November 2015 at 19:41:12 UTC, Marco Leise wrote: >>> Am Tue, 24 Nov 2015 17:08:33 +0000 >>> schrieb BLM768 <blm768@gmail.com>: >>> >>> [...] >> >> thank you for your answers. >> >> I solved it. >> windows console like: >> fwide(core.stdc.stdio.stdout, 1); >> setlocale(0, cast(char*)"china"); > > You shouldn't need this cast. Try removing it; if it doesn't compile, something's wrong. Above code is for chinese displaying in windows console,the windows console is acsii,if i remove it,the console will display garbled,look like the following picture http://postimg.org/image/9kf5wdnx1/ so,i must add it |
November 26, 2015 Re: Something about Chinese Disorder Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to magicdmer | On Thursday, 26 November 2015 at 01:59:12 UTC, magicdmer wrote:
> On Wednesday, 25 November 2015 at 12:33:00 UTC, Marc Schütz wrote:
>> On Wednesday, 25 November 2015 at 04:09:29 UTC, magicdmer wrote:
>>> On Tuesday, 24 November 2015 at 19:41:12 UTC, Marco Leise wrote:
>>>> Am Tue, 24 Nov 2015 17:08:33 +0000
>>>> schrieb BLM768 <blm768@gmail.com>:
>>>>
>>>> [...]
>>>
>>> thank you for your answers.
>>>
>>> I solved it.
>>> windows console like:
>>> fwide(core.stdc.stdio.stdout, 1);
>>> setlocale(0, cast(char*)"china");
>>
>> You shouldn't need this cast. Try removing it; if it doesn't compile, something's wrong.
>
> Above code is for chinese displaying in windows console,the windows console is acsii,if i remove it,the console will display garbled,look like the following picture
> http://postimg.org/image/9kf5wdnx1/
> so,i must add it
No, I'm talking specifically about the cast in there, not the call to setlocale(). Does it still work if you replace this:
setlocale(0, cast(char*)"china");
by that:
setlocale(0, "china");
?
|
November 27, 2015 Re: Something about Chinese Disorder Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Thursday, 26 November 2015 at 09:59:01 UTC, Marc Schütz wrote:
> No, I'm talking specifically about the cast in there, not the call to setlocale(). Does it still work if you replace this:
>
> setlocale(0, cast(char*)"china");
>
> by that:
>
> setlocale(0, "china");
>
> ?
yes Of course,it works well :)
I copy the code from internet and not notice that,thank you
|
December 02, 2015 Re: Something about Chinese Disorder Code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rikki Cattermole | On 25/11/2015 2:16 PM, Rikki Cattermole wrote:
> On 25/11/15 1:47 AM, Meta wrote:
>> I'm pretty sure you can just do:
>>
>> wstring text = "my string";
>>
>> Or
>>
>> auto text = "my string"w;
>
> The second one is correct yes.
> I'm just assuming that it isn't compiled into the executable.
Either is fine. Non-suffixed string literals have a default type of string, but implicitly convert to wstring/dstring at compile time.
|
Copyright © 1999-2021 by the D Language Foundation