社区
C++ 语言
帖子详情
"Cannot open the file"! Why?
yezilin
2007-09-02 06:11:13
void main()
{
string infile;
ifstream in(infile.c_str());
if(!in)
{
cout<<"Cannot open the file"<<endl;
}
else
cout<<"got it"<<endl;
}
结果输出 "Cannot open the file" 为什么呢?请指教!
...全文
243
4
打赏
收藏
"Cannot open the file"! Why?
void main() { string infile; ifstream in(infile.c_str()); if(!in) { cout<<"Cannot open the file"<<endl; } else cout<<"got it"<<endl; } 结果输出 "Cannot open the file" 为什么呢?请指教!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yezilin
2007-09-02
打赏
举报
回复
Thank you very much. I really got it now.
我以为infile就是文件名呢!呵呵!
gfxiang
2007-09-02
打赏
举报
回复
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string infile;
cout << "Enter input file name:"
cin >> infile;
ifstream in(infile.c_str());
if(!in)
cout <<"Cannot open the file: " << infile <<endl;
else
cout << "got it" <<endl;
in.close();
return 0;
}
iatsbg
2007-09-02
打赏
举报
回复
string infile;
要换成
string infile="c:\\abc.txt";//换成你要打开的文件的名称
cnvb
2007-09-02
打赏
举报
回复
因为你的infile变量什么也没有...
fatal error C1083: Cannot
open
include
file
: ‘new.h’
今天在VS2015上编译一个例子,发现在日文环境下编译没有问题,在英文环境下编译就提示以下错误:fatal error C1083: Cannot
open
include
file
: ‘new.h’ new.h是在一个系统中的.h中include的。 微软官方的关于C1083解释: 错误 C1083 | Microsoft Docs (balabala...都是大方向的分析(感觉有1万种可能出现这个错误),没啥实际帮助) 在网上怎么说的都有,说什么添加环境变量,什么添加路径。。。可能也能解决,但
excel cannot access the
file
there are several possible reasons
original link Microsoft Office Excel cannot access the
file
‘c:\
file
.xlsx’. There are several possible reasons:• The
file
name or path does not exist.• The
file
is being used by another program.• The...
libcblas.so.3: cannot
open
shared object
file
: No such
file
or directory错误完美解决(树莓派)
open
cv打开有时候会报错libcblas.so.3: cannot
open
shared object
file
: No such
file
or directory,但是我们安装完成了啊,为什么??这时候是因为你有一些文件没有配置好 解决方案 1.尝试一下以下代码安装一些包 sudo apt-get install libatlas-base-dev sudo apt-get install libjasper-dev sudo apt-get install libqt4-test ##
「cannot
open
shared object
file
」的解決方案
有時候執行一些指令,會碰到下面這樣的訊息: error while loading shared libraries: libiconv.so.2: cannot
open
shared object
file
: No such
file
or directory 在這個例子中,我們的程式找不到 libiconv.so.2 這個 dynamic library。那麼應該怎麼解決呢? 首先必
Go-The process cannot access the
file
because it is being used by another process.
where? Go程序在读取文件时候 why? 因为有其他进程也在读取和Go程序想要读取的文件,参数冲突 way? 关闭其他程序进程对该文件的读取操作 转载于:https://www.cnblogs.com/2bjiujiu/p/9039648.html...
C++ 语言
64,647
社区成员
250,475
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章