Results 1 to 3 of 3
Thread: Reading values from a text file
- 10-12-2012, 05:18 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 2
- Rep Power
- 0
Reading values from a text file
I'm creating a gambling game where the user's info (first/last name, running total of winnings) is stored in a text file.
If the user already has a file, it reads the file. The file looks like this:
Name: Steve Jobs
Balance: 300
Rounds won: 5
I was wondering how I could extract the value of Balance (in this example, 300) and use it as a variable so i could add/subtract to it everytime the player wins/loses.
Thanks!
- 10-12-2012, 05:20 AM #2
Re: Reading values from a text file
Option A
Read entire line and split the 300 value out.
Option B
Read the text "Balance:"
then read the int 300
- 10-12-2012, 05:27 AM #3
Member
- Join Date
- Oct 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Reading from a text file, then writing back to Text Area in Reverse
By medic642 in forum New To JavaReplies: 8Last Post: 07-17-2011, 02:38 PM -
Extracting values from a text file
By kryptonian03 in forum New To JavaReplies: 4Last Post: 03-22-2011, 06:13 AM -
need to input values from a text file into an array and count values
By pds8475 in forum New To JavaReplies: 14Last Post: 01-22-2011, 02:36 PM -
Reading Float values from a file
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:20 AM -
reading values from config file
By sathish_2111 in forum Enterprise JavaBeans (EJB)Replies: 3Last Post: 08-10-2007, 03:09 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks