Results 1 to 2 of 2
Thread: Reading FileInput data
- 07-05-2007, 06:58 AM #1
Senior Member
- Join Date
- Jun 2007
- Posts
- 111
- Rep Power
- 0
Reading FileInput data
Hi all, let's say we have a text file named "data1.txt" which contains 5 lines of random letters with no spaces.
I want to create a java program that reads the data in data1.txt and prints the length (number of letters on one line), the first 5 letters in data1.txt, and truncate those 5 letters to the first 3 letters and print those 3 letters on the output screen.
Basically, I just want a simple program that reads the data in a txt data file (with "File newone = new File("data1.txt");" ?) and manipulates what's read.
Thanks
Eric
- 07-05-2007, 06:59 AM #2
Member
- Join Date
- Jun 2007
- Posts
- 91
- Rep Power
- 0
The java tutorials has a great little piece of File IO that includes how to read in a file and how to scan each element inside of that file.
Scanning and Reading a File
After learning how to get each element of a file it should be rather easy to figure out how to just print out the first three.
Greetings
Daniel:o
Similar Threads
-
Reading data from Micrsoft excel and writing to notepad
By abhishek.jain in forum New To JavaReplies: 4Last Post: 01-29-2009, 08:12 AM -
Reading data form Excel using Jdbc (example)
By Java Tip in forum Java TipReplies: 0Last Post: 02-13-2008, 11:23 AM -
Reading Binary File and Changing data
By janakiram.attuluri in forum Advanced JavaReplies: 1Last Post: 12-21-2007, 10:10 AM -
Reading Data from a file
By ramachandran in forum New To JavaReplies: 2Last Post: 10-24-2007, 07:22 AM -
Reading file data that contains no spaces
By jdepue in forum Advanced JavaReplies: 1Last Post: 08-01-2007, 04:58 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks