io文件輸出流問題??運行時為什么提示找不到路徑,不是已經創建成功
package imooc;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileOutDemo1 {
?? ?/**
?? ? * @param args
?? ? */
?? ?public static void main(String[] args) throws IOException{
?? ??? ?// TODO Auto-generated method stub
?? ??? ?//如果該文件不存在直接創建,如果存在則刪除后重建
?? ??? ?FileOutputStream out = new FileOutputStream("demo/out.dat");
?? ??? ?out.write('A');
?? ??? ?out.write('B');
?? ??? ?int a = 10;//write只能寫八位,寫a需要寫四次
?? ??? ?out.write(a>>>28);
?? ??? ?out.write(a>>>16);
?? ??? ?out.write(a>>>8);
?? ??? ?out.write(a);
?? ??? ?out.close();
?? ??? ?
?? ??? ?IOUutil.printHex("demo/out.dat");
?? ??? ?
?? ??? ?
?? ??? ?
?? ?}
}
2015-11-12
文件路徑在流中需要雙斜杠。。。你試試吧
2016-10-25
2016-04-09
我剛開始也遇到了同樣的問題,解決辦法是:先創建一個demo文件夾
2016-03-16
反了,應該用\\
2015-11-12
斜杠反了....是\ ?而且要是雙\\ 用第一個\來轉義\ ? 別的沒仔細看...
2015-11-12
樓主不要急躁,我既然拿了你的積分,我就會好好滴幫你干活的...
2015-11-12
你這個是文件是放在哪里的,我看看
2015-11-12
還是不行? 怎么破