Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to input End of File indicator

 
John Eipe
Ranch Hand
Posts: 215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I read in a book that end of file could be given as input for a program. For Windows, it's <Ctrl> + Z.
But it never works.

This is the code i tried to work on:



Please let me know if I need to post the full program.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49457
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks like something out of chapter 14 of the Deitel book.
C:\JavaPrograms\DeitelCh14>edit Eipe.java

C:\JavaPrograms\DeitelCh14>javac Eipe.java

C:\JavaPrograms\DeitelCh14>java Eipe
Campbell
Campbell
Ritchie
Ritchie
^Z

C:\JavaPrograms\DeitelCh14>
You see I am, unusually, running Windows, and the program turned off when I used ctrl-Z. Please provide more details about what goes wrong.
 
John Eipe
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm running it from NetBeans IDE. Is that the reason, it doesn't work?

John Eipe
 
John Eipe
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it from command line and it works! What should I do in Net Beans?

John Eipe
 
Campbell Ritchie
Sheriff
Pie
Posts: 49457
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, I am afraid.
 
salvin francis
Bartender
Posts: 1280
10
Eclipse IDE Google Web Toolkit Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have worked on Netbeans

See, Editors like netbeans have an inbuild prompt that emulate the command prompt of the OS,
However, these should not be seens as a benchmark for your system.
usually editors now a days have limited support for text input via thier console.

if you do want to have an interactive user input in a CUI interface,
run the program via the os command prompt.

The problem is that now a days CUI is obsolete, you can prepare a GUI in a matter of seconds that does the same job in a more pleasing way.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that Eclipse allows this magic to happen
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic