A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
how to getcursor to first location of file?
Joined: Oct 26, 2006
Apr 01, 2008 19:00:00
I Just wrote a code that counts no of lines in a file
so the cursor has come to the end of line and unable to retrieve the data.
can any one help
Joined: Oct 21, 2007
Apr 01, 2008 19:44:00
You can use the
// open file junk for reading and writing RandomAccessFile f = new RandomAccessFile("junk", "rw"); // open crud for reading only RandomAccessFile ff = new RandomAccessFile("crud", "r"); //To append information to a RandomAccessFile, seek to the end of the file: f.seek(f.length()); //The beginning of a file is considered position 0. Therefore, to seek to the beginning of a file, use: f.seek(0);
You Want it.. Get it.......the Right Way...<br /> <br />SCJP 5.0 SCWCD 5.0
I agree. Here's the link:
subject: how to getcursor to first location of file?
WA #1.....word association
performance issues with file read and write
Struts FormFile (parsing .csv files)
Creating a file by giving relative path
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014