Link to home
Start Free TrialLog in
Avatar of zizi21
zizi21

asked on

Reading Text file/Binary File/Ascii file...

Hi,

For text files, we use Scanner reader=new Scanner(new File("output.txt")),

To write, we use PrintWriter pw=new PrintWriter(new FileWriter("test.txt"));

For random access file, we use RandomAccessFile rad=new RandomAccessFile("output.txt",rw).

I am confused on two things..Pls help..

Random access files means we can randomly access the file. Regardless, whether it is text, binary, ascii ?? Is this correct ??

For binary files, what do we use to read and write...???Pls help...Thank you very much..
ASKER CERTIFIED SOLUTION
Avatar of skyper3
skyper3

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zizi21
zizi21

ASKER

i cud use randomaccess file on binary,text and ascii files too ??
You can use it on whatever file is available, but it is treated as a binary file, no crlf conversions and such stuff.
Avatar of zizi21

ASKER

thanks, on the next question : For binary files, what do we use to read and write ?

For the ascii files, could i use the same method for read and write too??
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial