|
-
Nov 21st, 2005, 10:09 AM
#1
Thread Starter
Fanatic Member
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.
-
Nov 21st, 2005, 10:48 AM
#2
Re: Reading Integers
You could read them in as strings and parse them to numbers
Code:
int i = Integer.parseInt(reader.readLine());
-
Nov 21st, 2005, 10:49 AM
#3
Thread Starter
Fanatic Member
Re: Reading Integers
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|