Here is a simple piece of code:
import java.io.*;
public class Read {
public static void main(String[] args) {
BufferedReader f = new BufferedReader(ne
Is there a way by which I can make the Standard In(Command Line) active after the file being fed into the code is done?
Sorry to bump an old question, but none of the answers so far points out that there is a (shell-only) way to pass back to console input after piping in a file.
If you run the command
{ cat input.txt & cat; } | java Read
then the text from input.txt
will be passed to java Read
and you will then be dropped back to console input.
Note that if you then press Ctrl+D, you will get the infinite loop of null
s, unless you modify your program to end the loop when it receives null.