D:\temp\java>java ReadFile
Please input the directory name:
c:\Please input the file name:
auto.bat
can't find the file
/*
c:\auto.bat是存在的。如果我直接把"c:\\" 和 “auto.bat”作为参数放到
File input = new File(dir,fileBuf.toString());如
File input = new File("c:\\","auto.bat");
就一点问题没有。
*/
Please input the directory name:
c:\Please input the file name:
auto.bat
can't find the file
/*
c:\auto.bat是存在的。如果我直接把"c:\\" 和 “auto.bat”作为参数放到
File input = new File(dir,fileBuf.toString());如
File input = new File("c:\\","auto.bat");
就一点问题没有。
*/
-----------刚刚学习,无法回答你,抱歉!
输出fileBuf的值为空,感觉象被丢掉了。
new DataInputStream(
new BufferedInputStream(System.in));
String s;
try {
while((s = in.readLine()).length() != 0)
System.out.println(s);
// An empty line terminates the program
} catch(IOException e) {
e.printStackTrace();
}