October 28, 2006
"Chad J" <gamerChad@_spamIsBad_gmail.com> wrote in message news:ehuhhr$29gk$1@digitaldaemon.com...

> We shouldn't even need that to get some kind of readln() function.  Make it simple, it shouldn't need arguments (overload though for the fancy stuff) just read a line from the console.
>
> Later on if we want fromString, so we can do more fancy formatted input and stuff, ok, but for now I am kinda dissappointed with the /complete/ lack of console input function in phobos (disregarding std.c, because that's c not d and a pain to use IMO).
>
> I do miss a cheap/easy way to grab input like in C# w/ Console.ReadLine().

how about

import std.cstream;

...

int x;
float y;

din.readf("%d %f", &x, &y);

?

I agree, this should be available in std.stdio, but..


October 28, 2006
Chad J wrote:
> Frits van Bommel wrote:
>> Anders F Björklund wrote:
>>
>>> Frits van Bommel wrote:
>>>
>>>> This has been discussed before. IIRC, the rationale was 'stdio' refers to the standard input/output provided by the operating system (i.e. console i/o, by default).
>>>> Though std.stdio also seems to contain FILE* i/o, so maybe the name isn't _entirely_ appropriate.
>>>
>>>
>>> And it's even more funny as stdio doesn't contain any "input"...
>>
>>
>> Yeah, that too :).
>>
>>> But I guess that "std.stdo" would have sounded more strange :-)
>>
>>
>> Well, at least it leaves room for expansion :).
>>
>> What do you think, should Object get a method 'fromString' or something so we can add something like readf(ln) to std.stdio? ;)
> 
> We shouldn't even need that to get some kind of readln() function.  Make it simple, it shouldn't need arguments (overload though for the fancy stuff) just read a line from the console.
> 
> Later on if we want fromString, so we can do more fancy formatted input and stuff, ok, but for now I am kinda dissappointed with the /complete/ lack of console input function in phobos (disregarding std.c, because that's c not d and a pain to use IMO).
> 
> I do miss a cheap/easy way to grab input like in C# w/ Console.ReadLine().

You should look at Ares + Mango. IO is very well implemented.
October 28, 2006
Jarrett Billingsley wrote:

>>I do miss a cheap/easy way to grab input like in C# w/ Console.ReadLine().
> 
> how about
[...]
> din.readf("%d %f", &x, &y);
> 
> ?

It still doesn't work in GDC, though:

  din.readf("%d %f", &x, &y);
  dout.writef("%d %f", x, y);

3 3.14
0 nan

And I really don't like the din/dout.

> I agree, this should be available in std.stdio, but.. 

It really should. And "writeln" too.
The alternative libraries work, but.

--anders
1 2
Next ›   Last »