作者AI3767 (AI3767)
看板java
标题Re: [问题] RandomAccessFile 写中文的问题
时间Thu Mar 30 03:01:19 2006
※ 引述《NightPrince (shooting star)》之铭言:
: try
: {
: File file = new File(FILEPATH);
: RandomAccessFile ras = new RandomAccessFile(file , "rw");
: ras.seek(ras.length()); // 这边是以档案的最後做范例
: StringBuffer sb = new StringBuffer();
: .
: .
: .
: ras.writeBytes(sb.toString());
改成 ras.write(sb.toString().getBytes());
试试看
: ras.close();
: }
: catch(Exception ex)
: {
: ex.printTraceStack();
: }
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.123.219.115