converting numbers to strings and back

Daniel Keep daniel.keep.lists at gmail.com
Sat Oct 6 09:32:49 PDT 2007



dominik wrote:
> "Daniel Keep" <daniel.keep.lists at gmail.com> wrote in message
> news:fe736n$27ol$1 at digitalmars.com...
>> Using my tinfoil telepathy hat, I suspect you are... using a 1.x series
>> compiler, which does not have the std.conv.to!(T) template.  You'll need
>> to either use D 2.0 for that, or just use toFloat.
>
> ok I apparently was using 1.x compiler (I've downloaded what was
linked from
> main page).
> Now when I have downloaded newest version (2.005) I get the following
error
> with both methods (toFloat and to!):
>
> test.d(10): Error: cannot implicitly convert expression
(toString(fFloat))
> of ty
> pe const(char)[] to char[]
>
> same code, nothing changed, same error on both method of conversion.

That's because you're trying to assign a constant type into a mutable
type.  Which is what the compiler is telling you.  Either use 'auto' for
the storage class, or explicit assign it to a 'string' (or const(char)[]
if you really feel like it).

dominik wrote:
> ok after several more simple trials with 2.005 I still get this:
> 
> test.d(11): template instance identifier 'to' is not defined
> 
> so, do we have a problem here or am I missing something (like a module or 
> something)? 

Well, line 11 was "writefln(cTest);", so I assume you've changed
something, so I can't really help since I don't know what you've got any
more.

	-- Daniel


More information about the Digitalmars-d-learn mailing list