Re: convert string to ubyte[]

2017-11-11 Thread aki via Digitalmars-d-learn
On Saturday, 11 November 2017 at 15:48:59 UTC, Mike Parker wrote: auto s = "hello"; auto bytes = s.representation; https://dlang.org/phobos/std_string.html#.representation Thank you for the replay. Now I know. aki

Re: convert string to ubyte[]

2017-11-11 Thread bauss via Digitalmars-d-learn
On Saturday, 11 November 2017 at 15:48:59 UTC, Mike Parker wrote: On Saturday, 11 November 2017 at 15:38:18 UTC, aki wrote: [...] I don't know about the error you're seeing, but the generic way to get an array of the underlying data type of a string is via std.string.representation. import

Re: convert string to ubyte[]

2017-11-11 Thread user1234 via Digitalmars-d-learn
On Saturday, 11 November 2017 at 15:48:59 UTC, Mike Parker wrote: On Saturday, 11 November 2017 at 15:38:18 UTC, aki wrote: auto bytes = cast(immutable(ubyte)[])s; Of course, if you need a mutable array you should dup: auto bytes = cast(ubyte[])s.dup; Not only "should" but he "must" otherwise

Re: convert string to ubyte[]

2017-11-11 Thread Guillaume Piolat via Digitalmars-d-learn
On Saturday, 11 November 2017 at 15:38:18 UTC, aki wrote: Hello, This will be trivial question but I cannot figure out what's wrong. I want to convert string to an array of ubyte. import std.conv; void main() { auto s = "hello"; ubyte[] b = to!(ubyte[])(s); } It compiles but ca

Re: convert string to ubyte[]

2017-11-11 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 11 November 2017 at 15:38:18 UTC, aki wrote: Hello, This will be trivial question but I cannot figure out what's wrong. I want to convert string to an array of ubyte. import std.conv; void main() { auto s = "hello"; ubyte[] b = to!(ubyte[])(s); } It compiles but ca

convert string to ubyte[]

2017-11-11 Thread aki via Digitalmars-d-learn
Hello, This will be trivial question but I cannot figure out what's wrong. I want to convert string to an array of ubyte. import std.conv; void main() { auto s = "hello"; ubyte[] b = to!(ubyte[])(s); } It compiles but cause run time error: std.conv.ConvException@C:\APP\D\dmd2\w

setting file version, description, product name, etc

2017-11-11 Thread Dr. Assembly via Digitalmars-d-learn
I'm using below resource file as the following: "C:\dm\bin\rcc.exe" -32 -D__NT__ res.rc dmd -m32 -debug app.d res.res The icon is the only thing that is set. Everything else is missing from application's attributes. What am I missing? res.rc: IDI_ICON1 ICONDISCARDABLE "my.

Re: Class allocators

2017-11-11 Thread Eugene Wissner via Digitalmars-d-learn
On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote: Have anybody used allocators to construct class instances? Do you mean phobos allocators? or allocators as concept? What is the problem?

Class allocators

2017-11-11 Thread Nordlöw via Digitalmars-d-learn
Have anybody used allocators to construct class instances?