Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me  RSS feed

 
Arnab karmakar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problem with the following code.

char c = (char) input.read();

After the above line is executed .. when i try to take another input...it does not prompt for the input.

that is
char d = ( char) input.read();

I am not finding any prompt for the second input. Is there anything like flush which i used to have in C/C++.

Arnab
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the "input" object? If you are reading from standard input (System.in) you may be getting more data than you expect. Try echoing the characters back to standard output as you read them in.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please use specific topics - most people look for help.

And some will not answer to unspecific topics, unformatted code, and fantasy names.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!