• Post Reply Bookmark Topic Watch Topic
  • New Topic

Program Stoping for some reason

 
hennie louw
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am having trouble with a ap that needs to read
data from a com port and do things accordingly, but the ap also needs to the System.in stream for a ctrl+Z char and exit on that.
The problem is that the app doesnt seem to read the streams correctly
here is some sample code

Now what should happen is that once i press a key the system should print the Uncode number of that char to me on the screen, this works but only after I have pressed enter and the kbInput.read() reads a
<cr> ??? , this does not seem to me to be correct. how can i get the kbinput.read to read without waiting???
thus if there is nothing it should return a null value
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you'll probably find that data doesn't arrive into System.in from a shell until you press enter. I'm guessing that the shell captures any input to make sure that it doesn't need to handle it. c.f. ctrl-c sigkill a program, ctrl-z stopping a running unix process.
Using your code extract you would probably get something like
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!