标题:renameto
取消只看楼主
知为
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2005-10-21
 问题点数:0 回复次数:0 
renameto
import java.io.*;
import java.util.Date;
class attributes{
static void fileData(File f) {
System.out.println("get name :"+f.getName()+"\nget parent dir:"+f.getParent()+"\nget last Modified date"+new Date(f.lastModified())+"\nget length :"+f.length());
}
}
public class myfileHomework4{
public static void main(String[] args) throws IOException {
File now=new File(args[0]);
attributes.fileData(now);
String temp;
long fpointer=0;
RandomAccessFile rf =new RandomAccessFile(now, "rw");
while(fpointer<rf.length()) {
fpointer=rf.getFilePointer();
temp=rf.readLine();
if(temp.equals("development")) break;
}
rf.seek(fpointer);
rf.writeBytes("java coding");
File comeon=new File(args[1]);
System.out.println("是否修改成功:"+now.renameTo(comeon)); //不知道为什么就是改不了

}
}
不知道为什么就是改不了
搜索更多相关主题的帖子: renameto 
2006-04-19 09:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-58477-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.381144 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved