www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - how to read a line from stdin ?

reply sai <sai_member pathlink.com> writes:
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
Nov 15 2005
parent reply Derek Parnell <derek psych.ward> writes:
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
Nov 15 2005
parent Sai <Sai_member pathlink.com> writes:
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

Nov 29 2005