what is the value of Escape key?
Hi
i have a n00b question but have already spent quite some time on it, without a positive result, hence the post!
Basically i want to get input from user, append it to a file and quit when user presses the escape key.
===========================================================
System.out.println("Enter the text to be written:");
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
{
//Problem line ..i dont know what to put in here
while(c=(in.read()) != "")
{
filewriter.write(c);
}
[584 byte] By [
karanJa] at [2007-11-27 6:38:31]

There's no character associated with the escape key. If you were capturing key events in swing, it would be possible, but since pressing escape doesn't put any character into the standard input stream, there's nothing for your BufferedReader to read.
> thanks Helloworld
>
> lets say if i use "QUIT" as the escape word, then how
> do i use it in the while loop as read() returns int
> value. I cant compare a string"quit" with integer
> value.
Read the input as a line, not a single character. Then you can compare the input to the "quit" string.