Karen16 de Abril del 2009
PreguntaEstoy intentando hacer una funcion para leer caracter a caracter un fichero txt. y lo vaya mostrando por pantalla. De momento tengo:
import java.io.*;
public class Lectura{
public void main (String args[]) throws IOException
{
File fichero = new File("C:\Documents and Settings\workspace\Textos\texto.txt");
int c;
FileReader in = new FileReader(fichero);
while((c = in.read()) != -1)
{
System.out.println((char)c);
}
in.close();
}
}
Lo estoy haciendo con Eclipse.
Pero me da error al debugar en el main. Alguien me podria ayudar?? gracias
import java.io.*;
public class Lectura{
public void main (String args[]) throws IOException
{
File fichero = new File("C:\Documents and Settings\workspace\Textos\texto.txt");
int c;
FileReader in = new FileReader(fichero);
while((c = in.read()) != -1)
{
System.out.println((char)c);
}
in.close();
}
}
Lo estoy haciendo con Eclipse.
Pero me da error al debugar en el main. Alguien me podria ayudar?? gracias
