(1):试试用下面这个函数
public final void writeUTF(String str) throws IOException
  Writes a string to the file using UTF-8 encoding in a machine-independent manner. 
  First, two bytes are written to the file, starting at the current file pointer, as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for each character.(2):每一次写入文件指针都会往后移,所以想继续写入,执行write函数就可以的。

解决方案 »

  1.   

    logFile.writeBytes("\nUser : "+TxtName.getText()+" at "+LabTime.getText()+" Connection!");这样不行啊!!请你说详细一点行吗??
      

  2.   

    String str = "User : "+TxtName.getText()+" at "+LabTime.getText()+" Connection!/";
    str = str +"/r/n";
    str =new String(str.getBytes("UFT-8"),"UFT-8");
    RandomAccessFile logFile = new RandomAccessFile("C:\\UInfo.log","rw");
    logFile.seek(logFile.length());
    logFile.writeBytes();
      

  3.   

    对不起,最后一行应该为logFile.writeBytes(str);