•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 455,967 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,740 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 350 | Replies: 1 | Solved
![]() |
•
•
Join Date: Sep 2007
Posts: 12
Reputation:
Rep Power: 2
Solved Threads: 0
Hey guys,
I'm trying to read from a file and put each column into it's corresponding array.
This does not work, I'm thinking that the s.nexttoken is continuing past each line read in.
Any suggestions?
I'm trying to read from a file and put each column into it's corresponding array.
% P_ID CPU_burst I/O_burst Priority
0 10 4 2
1 8 2 1
2 12 0 5
while ((Line=myInput.readLine()) != null) {
StringTokenizer s = new StringTokenizer(Line);
//System.out.println(Line);
pid[counter]= Integer.parseInt(s.nextToken().toString());
cpu[counter]= Integer.parseInt(s.nextToken().toString());
io[counter]= Integer.parseInt(s.nextToken().toString());
prior[counter]= Integer.parseInt(s.nextToken().toString());
counter++;
} This does not work, I'm thinking that the s.nexttoken is continuing past each line read in.
Any suggestions?
Last edited by chris53825 : Nov 17th, 2007 at 3:30 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- tokenizer (Java)
- Help...How do i use the Tokenizer? (Java)
- Java's String Tokenizer (Java)
- stream tokenizer (Java)
- String Tokenizer Help (Java)
- Java with String Tokenizer (Java)
Other Threads in the Java Forum
- Previous Thread: jdic browser and right container
- Next Thread: Delete button not working on my Java GUI Inventory


Linear Mode