Results 1 to 3 of 3

Thread: Reading Integers

  1. #1

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Resolved Reading Integers

    How can i read integers from a txt file of numbers?

    I have tried to use BufferedReader and FileReader, but it seems like these can only read strings.

    Nevermind, i've solved my problem.

    Solution: Just convert the string input to an integer before writing it to the integer array.
    Last edited by x-ice; Feb 25th, 2007 at 07:25 PM.

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196

    Re: Reading Integers

    You could read them in as strings and parse them to numbers
    Code:
    int i = Integer.parseInt(reader.readLine());

  3. #3

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Re: Reading Integers

    Quote Originally Posted by DeadEyes
    You could read them in as strings and parse them to numbers
    Code:
    int i = Integer.parseInt(reader.readLine());
    Thanks. Lol you must have posted that 5 seconds before me, check my original post.

Posting Permissions

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



Click Here to Expand Forum to Full Width