作者PRI (蜂蜜幸运草)
看板MacDev
标题[问题] C++开档的问题?
时间Sun Apr 27 11:50:51 2008
程式的片段...
.
.
.
ifstream infile( "in_file" );
if ( ! infile ){
cerr << "error : unable to open input file!";
return -1;
}
.
.
.
我把 in_file 和 main.cpp 放在同一个 project目录中...
不过执行时都是出现
error : unable to open input file!
我不懂是找不到这一个档案
或是 开不起来???
..╮(﹋﹏﹌)╭..
--
☆◢▇
▅▄▃▁ ▁
▃▄▅▇◣
☆
◥
█◣▆◤ ◣ ◢
◥▆◢█◤
◥█▂▃▄▅ ▅▄▃▂█◤
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.134.194.65
1F:推 ducksteven:好像问错板了 :p 04/27 19:36
2F:推 nighter:in_file 要放在 Project目录下Debug资料夹里 04/28 14:24
3F:→ nighter:因为 编译完出来的执行档在那,所以你的in_file也要在那 04/28 14:25
4F:→ nighter:不然就写死绝对路径,譬如把档案放在/tmp 下 04/28 14:26
5F:→ nighter:ifstream infile( "/tmp/in_file" ); 04/28 14:28
6F:→ PRI:谢谢...我去试看看..因为我想说 04/29 11:26
7F:→ PRI:是用X CODE编译产生的问题所以才来这问说抱歉 04/29 11:27
8F:推 Blueshiva:没有什麽好抱歉的啦~ 04/29 11:48