| @ -0,0 +1,6 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <classpath> | |||||
| <classpathentry kind="src" path="src"/> | |||||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | |||||
| <classpathentry kind="output" path="bin"/> | |||||
| </classpath> | |||||
| @ -0,0 +1,17 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>MiCat</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.jdt.core.javabuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| <nature>org.eclipse.jdt.core.javanature</nature> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @ -1,2 +1,10 @@ | |||||
| # 05MiCat | # 05MiCat | ||||
| java MiCat ruta | |||||
| Solo se escribe Esto es una prueba | |||||
| ``` | |||||
| Escribe algo | |||||
| Esto es una prueba\ no se muestra | |||||
| ``` | |||||
| @ -0,0 +1,39 @@ | |||||
| package es.antoniotgit; | |||||
| import java.io.File; | |||||
| import java.io.FileWriter; | |||||
| import java.io.IOException; | |||||
| import java.util.Scanner; | |||||
| public class MiCat { | |||||
| public static void main(String[] args) throws IOException{ | |||||
| Scanner lector = new Scanner(System.in); | |||||
| String path = args[0]; | |||||
| File fichero = new File(path); | |||||
| FileWriter fic = new FileWriter(fichero, true); | |||||
| String fin = "\\"; | |||||
| System.out.println("Escribe algo"); | |||||
| String texto = lector.nextLine(); | |||||
| for (int i = 0; i < texto.length(); i++) { | |||||
| String caracter = String.valueOf(texto.charAt(i)); | |||||
| if (caracter.equalsIgnoreCase(fin)) { | |||||
| fic.close(); | |||||
| } else { | |||||
| fic.write(caracter); | |||||
| } | |||||
| } | |||||
| fic.close(); | |||||
| } | |||||
| } | |||||