This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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
I agree. Here's the link:
subject: Writing a file
It's not a secret anymore!