Results 1 to 7 of 7
  1. #1
    tress is offline Member
    Join Date
    Mar 2008
    Location
    Florida Johannesburg
    Posts
    2
    Rep Power
    0

    Default Reading Integers from a text file

    Hi guys I need help in reading information from a file and stroring the Integers from that information. Can anyone please help:D

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    What you have tried up to now. Any try? where you stuck with? Try to make a effort before asking help. People not give code here, they always ready to help what you have done.

    So don't worry pal. Just try and comeback here. At least I give a code :)

  3. #3
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    Can you please provide us with an example of the file you want to read?
    Did this post help you? Please me! :cool:

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I think he used a file something like this.

    123
    453
    456
    224

    It's not difficult to do it, in few recent post we talk about much similar things in our community.

    Try to read file line by line first. Then think about how to deal with the type, integer, String etc....

  5. #5
    e-hacker is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    i am using notepad as database for my project
    now data is something like this:
    12,3,2
    4,34,5

    i have read it using dis.readline() now it how i convert this into int or float
    if i do this
    i= (int) dis.readChar();
    System.out.println(i);
    gives exception

  6. #6
    e-hacker is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    <script>alert("hi")</script>

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

Similar Threads

  1. [SOLVED] Reading a text file into an Array
    By DonCash in forum New To Java
    Replies: 13
    Last Post: 01-25-2011, 12:51 AM
  2. Applet - reading text files packed into JAR file
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-08-2008, 09:15 AM
  3. Reading text from a URL using BufferedReader
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 10:17 AM
  4. Reading text file
    By Lennon-Guru in forum New To Java
    Replies: 1
    Last Post: 12-15-2007, 11:38 PM

Posting Permissions

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