digitalmars.D - How...
- Dawid =?UTF-8?B?Q2nEmcW8YXJraWV3aWN6?= (8/8) Aug 10 2004 ...to operate easly on std.stream.stdout and std.stream.stdin ? Howto pr...
...to operate easly on std.stream.stdout and std.stream.stdin ? Howto print ints, strings etc. Where is char[] itoa(int); ? -- Dawid Ciężarkiewicz | arael jid: arael fov.pl
Aug 10 2004
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
Aug 11 2004
"Nick" <Nick_member pathlink.com> wrote in message news:cfddop$t7n$1 digitaldaemon.com...<whine-mode> The whole input/output setup in D seems a bit arbitrary and beta-ish atthemoment, I know... For example there is no connection between streams andthewritef(ln) routines - the streams only contain the (IMHO outdated)printf() Cworkalike. There's no swritefln to write to a stream or a string, andthere's nounified way to read input from the user that I know of (readf / readfln??) </whine-mode>You can swritefln to a string using std.string.format().
Aug 11 2004
In article <cff07v$1qg8$1 digitaldaemon.com>, Walter says...You can swritefln to a string using std.string.format().Ok, thanks, I wasn't aware of that. Nick
Aug 12 2004