char* to long
Mantis
mail.mantis.88 at gmail.com
Tue Jan 24 13:02:18 PST 2012
24.01.2012 22:48, Mars пишет:
> Hello everybody.
> I have to convert a char* (from a C function) to long. At the moment
> I'm using
>> long foo = to!long( to!string(bar) );
> but this doesn't feel right... with 2 to calls. Is this the way to go?
> Or is there something better?
>
> Mars
>
This seems to work:
char[] c = "123\0".dup;
auto l = parse!long(c);
writeln( l );
More information about the Digitalmars-d-learn
mailing list