[問題] 判斷File是否存在?

看板C_and_CPP (C/C++)作者 (千里之外)時間13年前 (2013/01/24 21:09), 編輯推噓0(004)
留言4則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) visual c++ 2008 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 我的code如下,在某一 function() { if(System::IO:File::Exist(file_path1)) { do somthing1 } if(System::IO:File::Exist(file_path12)) { do somthing2 } if(System::IO:File::Exist(file_path3)) { do somthing3 } if(System::IO:File::Exist(file_path4)) { do somthing4 } } path1: xxx\001.bin path2: xxx\002.bin path3: xxx\003.bin path4: xxx\yy\004.bin 餵入的資料(Input): 預期的正確結果(Expected Output): 判斷4個檔案是否存在...若存在...做該做的事... 假設4個file都存在...就會做something1~4 錯誤結果(Wrong Output): 只會做1~3件...第4個file判定不存在...但實際上是存在的... 我把1~3給註解掉...結果做了第四件事... 我把第4個file移到最上頭(變第1個判斷)...(4->1->2->3) 結果做了4、3的事情... 我百思不得其解....請高手說明... 還是我見鬼了... 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.44.230.199

01/24 21:12, , 1F
你在do something3裡面return 了?
01/24 21:12, 1F

01/24 21:16, , 2F
當然沒有...只是顯示一些顏色或是checked = ture而已
01/24 21:16, 2F

01/24 21:19, , 3F
看起來像3丟了exception
01/24 21:19, 3F
※ 編輯: spiderman007 來自: 114.44.230.199 (01/24 21:37)

01/24 22:07, , 4F
有code嗎@@
01/24 22:07, 4F
文章代碼(AID): #1H0JA9dU (C_and_CPP)
文章代碼(AID): #1H0JA9dU (C_and_CPP)