2016-10-10 66 views
0

嗨,我是一個C++新手,我遇到了這個問題。我瀏覽了很多在線資源,找不到答案。請幫忙。謝謝。ifstream_class.open沒有打開文件

std::ifstream openfile; 
openfile.open("file.txt"); 
if(openfile.is_open()){ 
    std::cout<<"opned"<<std::endl; 
} 
else{ 
    std::cout<<"not open"<<std::endl; 
} 

輸出始終是「無法打開」

+2

你確定該文件是存在的? –

+0

@GillBates > this_file >文件夾 > file.txt 問題是,即使我將其更改爲「folder/file.txt」也無濟於事 – WEPIOD

回答