diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fb50116 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..c2574ca --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + MiCat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/README.md b/README.md index d2be4ef..13f7da4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ # 05MiCat +java MiCat ruta + +Solo se escribe Esto es una prueba + +``` +Escribe algo +Esto es una prueba\ no se muestra +``` \ No newline at end of file diff --git a/bin/es/antoniotgit/MiCat.class b/bin/es/antoniotgit/MiCat.class new file mode 100644 index 0000000..2d9e636 Binary files /dev/null and b/bin/es/antoniotgit/MiCat.class differ diff --git a/src/es/antoniotgit/MiCat.java b/src/es/antoniotgit/MiCat.java new file mode 100644 index 0000000..1d1964a --- /dev/null +++ b/src/es/antoniotgit/MiCat.java @@ -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(); + } + +}