System.in question

S

samhng

There is a fragment of the following:

System.out.println("Reading from standard input...");
classT t = new ClassT(System.in);

When running the program, I don't know how to terminate the input after
enterred enough data.

Anyone can help me out of this little problem? Thanks!
 
R

Roland

There is a fragment of the following:

System.out.println("Reading from standard input...");
classT t = new ClassT(System.in);

When running the program, I don't know how to terminate the input after
enterred enough data.

Anyone can help me out of this little problem? Thanks!
On Windows: CTRL-Z
On Unix: CTRL-D
Maybe you have to hit the Enter/Return key after the control-key
combination.

--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
J

John C. Bollinger

Roland said:
On Windows: CTRL-Z
On Unix: CTRL-D
Maybe you have to hit the Enter/Return key after the control-key
combination.

Or if the standard input is redirected from a file then end-of-stream
will happen automatically. If it is piped in from another process, then
that other process should close its standard output, or simply terminate.

Any way about it, indicating the end of data on the standard input is by
definition a matter external to your program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top