[3847] in java-interest
Re: how to read from stdin?
daemon@ATHENA.MIT.EDU (Michael Mehrle)
Wed Nov 29 21:20:53 1995
Date: Wed, 29 Nov 1995 14:45:13 -0700
To: grege@optimation.com.au (Greg Ewing)
From: michael@w3media.com (Michael Mehrle)
Cc: java-interest@java.sun.com
>Hi,
>
>Could someone please guide me as to how I can read input
>from stdin?
>
>I've tried stuff like:
>
>DataInputStream dataStream = new DataInputStream(System.in);
>String input = dataStream.readLine();
>
>Perhaps I should open a FileInputStream instead?
>
>Thanks for your time
>
>GREG
>
>grege@optimation.com.au
>
>
>
I'll throw in my 2 cents!
import java.io.DataInputStream;
class ReadInput {
public static void main(String args[]) {
String line;
DataInputStream myDataInputStream;
myDataInputStream = new DataInputStream(System.in);
do {
line = myDataInputStream.readLine();
.... // do what you must with it ;)
}
}
That *should* work, lemme know!
I however would like to know how to accept several lines in the body of the
"do" loop and write them into an string array! Anybody?
Michael
\\///
[ o-o ]
____________OOOo___(.)___oOOO_______________
http://www.w3media.com/w3media
michael@w3media.com
Tel. 310.441.9599
Fax 310.441.5919
"One man's mundane and desperate existence
is someone else's Technicolor."
-Strange Days-
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com