作者victoret (戲言~)
看板EE_DSnP
標題[問題] 關於 dofile 指令
時間Thu Oct 27 17:42:57 2011
在使用 ref 裡的 modCalc-32 的時候
輸入 do do1 的時候會顯示 Error: cannot open file "do1"!!
假如把 modCalc-32 丟到 dofiles 的資料夾
輸入 do do1 就不會有任何問題
假如把 modCalc-32 丟到 hw3 這個資料夾(就是裝 src lib bin dofiles...etc. 的)
輸入 do do1 一樣顯示 Error: cannot open file "do1"!!
可是這時候假如加上路徑,像是
輸入 do ./dofiles/do1 的話,那也可以順利進行
想請問一下這是否是正常的狀況
還有做 openDoFile 和 closeDoFile 的時候,我們也要做成這樣的形式嗎?
感謝!!!
--
理所當然的某項事物,卻會以某天為區隔,從此變得不再理所當然。
恩田陸 夜間遠足
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.25.108
1F:推 ric2k1:DOfile 指令只會讀 "目前目錄" 的 dofile, 所以如果 dofile 10/27 17:48
2F:→ ric2k1:不在目前目錄,就要 specify 相對路徑,像是 ../dofiles/do 10/27 17:49
3F:→ ric2k1:openDoFile & closeDoFile 就把它從 command line 吃到的 10/27 17:49
4F:→ ric2k1:string (含相對路徑) 丟給 fstream::open() 就好了! 10/27 17:50
5F:→ ric2k1:不需要特別處理。 10/27 17:50
6F:推 vuluy:這樣在別的目錄執行do do2的時候就叫不出do1了 10/27 17:59
7F:→ victoret:感謝教授! 10/27 18:00