Posted By:
gil_dan
Posted On:
Wednesday, March 17, 2004 09:28 AM
hi, i'm building a simple command-line chat program. i use BufferedReader(InputStreamReader(System.in)) to read from keyboard. let's call this object typeIn. when i end the program...i will close all the IO streams and sockets before exiting the program. but i have a slight problem...it seems that typeIn will not close until i press Enter. here's wat i did... System.out.print("Closing typeIn..."); if(typeIn!=null) typeIn.close(); System.out.println("done"); is there any way i can "insert" an Enter character without pressing on the keyboard? i dun wanna affect the print statements in between the typeIn.close() statement.
More>>
hi, i'm building a simple command-line chat program.
i use BufferedReader(InputStreamReader(System.in)) to read from keyboard. let's call this object typeIn.
when i end the program...i will close all the IO streams and sockets before exiting the program.
but i have a slight problem...it seems that typeIn will not close until i press Enter.
here's wat i did...
System.out.print("Closing typeIn...");
if(typeIn!=null) typeIn.close();
System.out.println("done");
is there any way i can "insert" an Enter character without pressing on the keyboard? i dun wanna affect the print statements in between the typeIn.close() statement.
thx,
gildan2020
<<Less