2016-10-10 67 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

回答