|
|
@ -0,0 +1,47 @@ |
|
|
|
import java.io.BufferedWriter; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileWriter; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
public class principal { |
|
|
|
|
|
|
|
static Scanner teclado = new Scanner(System.in); |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
File fichero; |
|
|
|
|
|
|
|
fichero = new File("texto.txt"); |
|
|
|
|
|
|
|
String datos = ""; |
|
|
|
|
|
|
|
try { |
|
|
|
FileWriter escribir = new FileWriter(fichero, true); |
|
|
|
BufferedWriter buffer_escribir = new BufferedWriter(escribir); |
|
|
|
|
|
|
|
int i = 0; |
|
|
|
|
|
|
|
while(i == 0) { |
|
|
|
if(datos.contains("\\")) { |
|
|
|
System.out.println("Se termino."); |
|
|
|
i=1; |
|
|
|
}else { |
|
|
|
System.out.println("Escribe algo."); |
|
|
|
datos = teclado.next(); |
|
|
|
buffer_escribir.write(datos); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//buffer_escribir.append(datos); |
|
|
|
buffer_escribir.flush(); |
|
|
|
buffer_escribir.close(); |
|
|
|
|
|
|
|
}catch(IOException e1) { |
|
|
|
e1.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |