public static void main(String[] args) throws IOException {
InputStream istream;
int c;
final int EOF = -1;
istream = System.in;
FileWriter outFile = new FileWriter("C:/Users/boamb/Documents/NetBeansProjects/DSA_BSE20BFT/src/week7/Data.txt",true);
BufferedWriter bWriter = new BufferedWriter(outFile);
System.out.println("Enter fruits to store in data File – Press Ctrl+Z to end ");
while ((c = istream.read()) != EOF)
bWriter.write(c);
bWriter.close();
}
Hi everyone, I am trying to insert data in a file through the system output in the NETBEANS IDE but the issue is when i am pressing CTRL+Z it is not working, the program is still running and when i stop it manually there are no data saved in the file. This is my piece of code.