Browse Source

funciona

master
antoniotgit 2 years ago
parent
commit
b6da3969be
5 changed files with 70 additions and 0 deletions
  1. +6
    -0
      .classpath
  2. +17
    -0
      .project
  3. +8
    -0
      README.md
  4. BIN
      bin/es/antoniotgit/MiCat.class
  5. +39
    -0
      src/es/antoniotgit/MiCat.java

+ 6
- 0
.classpath View File

@ -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>

+ 17
- 0
.project View File

@ -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>

+ 8
- 0
README.md View File

@ -1,2 +1,10 @@
# 05MiCat
java MiCat ruta
Solo se escribe Esto es una prueba
```
Escribe algo
Esto es una prueba\ no se muestra
```

BIN
bin/es/antoniotgit/MiCat.class View File


+ 39
- 0
src/es/antoniotgit/MiCat.java View File

@ -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();
}
}

Loading…
Cancel
Save