| |
|
Nick
Posted in reply to Dawid Ciężarkiewicz
| In article <cfb6go$8nh$1@digitaldaemon.com>, Dawid =?UTF-8?B?Q2nEmcW8YXJraWV3aWN6?= says...
>
>...to operate easly on std.stream.stdout and std.stream.stdin ? Howto print ints, strings etc.
>
>Where is char[] itoa(int);
To convert something to a string, use toString(), which is defined in
std.string. To convert a atring to an integer type use toInt() which you can
find in std.conv. There is no toFloat() or toReal() or similar that I can find.
If you just want to write things to screen, use writef / writefln:
#import std.stdio;
..
int i = 3;
double d = 3.1415;
writefln(d, " is greater than ", i);
<whine-mode>
The whole input/output setup in D seems a bit arbitrary and beta-ish at the
moment, I know... For example there is no connection between streams and the
writef(ln) routines - the streams only contain the (IMHO outdated) printf() C
workalike. There's no swritefln to write to a stream or a string, and there's no
unified way to read input from the user that I know of (readf / readfln??)
</whine-mode>
Nick
|