Results 1 to 2 of 2
  1. #1
    j187 is offline Member
    Join Date
    Dec 2010
    Posts
    12
    Rep Power
    0

    Default problem reading a files lines

    hey guys im having a problem with this code, it reads the file in lines but the console shows it likes this:
    Java Code:
    {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
    {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
    {\colortbl;\red255\green255\blue255;}
    \paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
    \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
    
    \f0\fs24 \cf0 hola\
    como\
    estas\
    hola\
    holao\
    hola}
    Java Code:
    import java.io.*;
    
    
    public class readText {
        int x=0;
    
    
    public static void main(String[] args) {
    File f = new File( "/Users/javiergonzalez/Downloads/lineas.txt" );
    BufferedReader entrada;
    try {
    entrada = new BufferedReader( new FileReader( f ) );
    String linea;
    while(entrada.ready()){
    linea = entrada.readLine();
    System.out.println(linea);
    }
    }catch (IOException e) {
    }
    
    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Reading .bin files
    By spatel14 in forum New To Java
    Replies: 3
    Last Post: 06-22-2010, 04:39 PM
  2. Reading .txt files
    By cvcs1 in forum New To Java
    Replies: 3
    Last Post: 01-20-2010, 09:07 AM
  3. Replies: 5
    Last Post: 08-21-2009, 11:03 AM
  4. Reading specific lines
    By ivvgangadhar in forum New To Java
    Replies: 8
    Last Post: 01-12-2009, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •