linux 下 用  echo "、、、" >> filepath
perl,php  下 用  fopen (fp,">>filepath");

解决方案 »

  1.   

    c里面
    out=fopen(filepath,"w");
    fprintf(out, "、、、、");
      

  2.   

          直接覆盖文件 
          DataOutputStream out = new  DataOutputStream(
                                    new BufferedOutputStream(
                                      new FileOutputStream(filepath)));
          out.writeBytes("、、、、");
          out.close();
      

  3.   

    用RandomAccessFile.java类能实现你的想法!
      

  4.   

    hem: 你的想法和我一样,但我想知道java是否有类似c的文件追加方法?
      

  5.   

    关键是FileOutputStream 的构造函数,应该用
    out = new FileOutputStream(filepath,true);第二个参数设为true,就表示在文件末尾添加数据。
      

  6.   

    out = new FileOutputStream(filepath,true);注意第二个参数。
      

  7.   

    回复人:hello_wyq(半瓶墨水) (2001-5-7 20:30:00)  得0分 
    用RandomAccessFile.java类能实现你的想法!
     
     我看了一下 RandomAccessFile 的API 觉得好像可以 只是 rw 不知道是不是追加。 
    需要试一试。
      

  8.   

    回复人:Shania(猫卯) (2001-5-7 21:03:00)  得0分 
    关键是FileOutputStream 的构造函数,应该用
    out = new FileOutputStream(filepath,true);第二个参数设为true,就表示在文件末尾添加数据。
     
    是的 不错 。import java.io.*;
    import java.util.*;
    import java.sql.*;
    import java.lang.Integer;  
    public class fwrite {
     public static void main(String argv[]){
    try{
    System.out.println("asdf");
    DataOutputStream out = new  DataOutputStream(
                                    new BufferedOutputStream(
                                      new FileOutputStream("/fwrite.txt",true)));  
    out.writeBytes("asdf");
    out.close();
    }
    catch(Exception ex){
    System.out.println(ex.toString());
    }
    }
    }
      

  9.   

    其实 import java.sql.* ; 
    import java.lang.Integer;
    是不必要的, 我当时从别的文件拷贝过来的 ,呵呵