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();
}
Hola a todos, estoy tratando de insertar datos en un archivo a través de la salida del sistema en el IDE NETBEANS, pero el problema es cuando estoy presionando CTRL+Z no está funcionando, el programa se sigue ejecutando y cuando me pare manualmente no hay datos guardados en el archivo. Este es mi trozo de código.