aspose file tools*
The moose likes Beginning Java and the fly likes Writing a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Writing a file" Watch "Writing a file" New topic

Writing a file

Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Hello. I'm having trouble to write a file the way I want. I want a .txt file to be written by a program in exactly this way:

...but my program records this onto the file.
�HP7 d �

This is the code of my method

Note: I am using a Random Access File - raf

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

You can use PrintWriter with its println() method to do that.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
It is sorta covered in the JavaRanch Style Guide.
subject: Writing a file