[5141] in java-interest

home help back first fref pref prev next nref lref last post

Re: Problems on append a exist file.

daemon@ATHENA.MIT.EDU (Mete Senocak)
Tue Jan 30 04:18:39 1996

Date: Mon, 29 Jan 1996 23:26:58 -0800
From: Mete Senocak <msenocak@arachnid.microweb.com>
To: mark@hactl.com.hk
Cc: java-interest@java.sun.com

Hi Mark:

mark@hactl.com.hk wrote:
> 
>      Hi, everybody,
> 
>      I am now writing a Java application (not applet) for file management.
>      The problem I meet is I can not append new line to the exist file.
>      Each time I create a FileOutputStream, it overwrite the exist file.
>      Could someone please tell me how to append a file? Thanks a lot!
> 
>      regards,
> 
>      Mark
> -

Without looking at your code, let me ask this: Did you place your file 
pointer at the end of the file before writing to the file? If not, that 
explains the cause of your problem.

This will put the pointer at the end of your file:

yourFile.seek(yourFile.length());

Good luck,

- Mete
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post