View mode: basic / threaded / horizontal-split · Log in · Help
November 16, 2005
how to read a line from stdin ?
Could someone please tell me how to read a line from console using stdin ?

-------------
import std.stream;
stdin.readLine();  //  is not working

-------------
import std.stdio;
stdin.readLine();  //  compiler error 

Thanks in advance
Sai
November 16, 2005
Re: how to read a line from stdin ?
On Wed, 16 Nov 2005 00:48:35 +0000 (UTC), sai wrote:

> Could someone please tell me how to read a line from console using stdin ?
> 
> -------------
> import std.stream;
> stdin.readLine();  //  is not working
> 
> -------------
> import std.stdio;
> stdin.readLine();  //  compiler error 
> 
> Thanks in advance
> Sai

Example:
 ========================
import std.cstream;
import std.stdio;
void main()
{
   char[] x;

   x = din.readLine();
   writefln("Got '%s'", x);

}
 ====================


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
16/11/2005 12:02:54 PM
November 29, 2005
Thank you -- Re: how to read a line from stdin ?
Thank you Derek.

In article <1ehr73cehnsrq$.kcumt0e14i5w.dlg@40tude.net>, Derek Parnell says...
>
>On Wed, 16 Nov 2005 00:48:35 +0000 (UTC), sai wrote:
>
>> Could someone please tell me how to read a line from console using stdin ?
>> 
>> -------------
>> import std.stream;
>> stdin.readLine();  //  is not working
>> 
>> -------------
>> import std.stdio;
>> stdin.readLine();  //  compiler error 
>> 
>> Thanks in advance
>> Sai
>
>Example:
>  ========================
>import std.cstream;
>import std.stdio;
>void main()
>{
>    char[] x;
>
>    x = din.readLine();
>    writefln("Got '%s'", x);
>
>}
>  ====================
>
>
>-- 
>Derek
>(skype: derek.j.parnell)
>Melbourne, Australia
>16/11/2005 12:02:54 PM
Top | Discussion index | About this forum | D home