This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Writing a file" Watch "Writing a file" New topic
Author

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:
1001
HP7
23
100
200

...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


Olly
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: http://aspose.com/file-tools
 
subject: Writing a file
 
Similar Threads
Creating Random Access File
Error handling problem
Inserting text to a file
Why is my type unexpected? required variable found value
Fibonacci Generators and the loop commands.