[問題] 判斷File是否存在?
開發平台(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
01/24 21:12, 1F
→
01/24 21:16, , 2F
01/24 21:16, 2F
→
01/24 21:19, , 3F
01/24 21:19, 3F
※ 編輯: spiderman007 來自: 114.44.230.199 (01/24 21:37)
→
01/24 22:07, , 4F
01/24 22:07, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章