sourceFile.open(filepath);
sourceFile.open(filepath);
有什么问题可能的重复:
C 的参数类型ifstream :: Open()
C 使用字符串作为打开文件路径的ifstream错误。
ifstream sourceFile;
sourceFile.open(filepath);
我正在得到一些信息:
无匹配功能呼叫
ifstream::open(string&)
怎么了?
与
相同ifstream sourceFile(filepath)
filepath是字符串
从C 11开始,iostreams可以将string
作为命名要打开的文件的参数 - 但这是在C 11中添加的,因此有很多库''t包括它。更新到您的编译器/库的最新版本可能的帮助(但再一次,我怀疑支持甚至是通用的)。
看起来filepath
是string
。 Open
仅采用原始指针。这样做-Open(filepath.c_str());
它需要char* filename
,而不是 String 作为参数。
sourceFile.open(filepath.c_str());
The Function is std::ifstream::open
void open ( const char * filename, ios_base::openmode mode = ios_base::in );
(参考)
相关文章:
- Poco::Net::FTPClientSession 在 open() 方法上挂起 129 秒,如果 ftp 主机不存
- Node.js fs.open() 在尝试打开 4 个以上的命名管道 (FIFO) 后挂起
- POSIX open() 挂在 SMB 共享上
- QDirIterator语言 - No hasNext not FilePath reaction
- C++:std::ofstream 方法 open() 在第二次迭代时擦除打开的 ifstream 文件
- Visual Studio "fatal error LNK1104: cannot open file"未使用或包含的库
- C++ 错误检查 fstream open() 命令和一般字符串流错误处理
- VS 2017 C++ - "cannot open source file 'sqlite3.h' "
- 在VS 15.7.5中,悬停在Open CV 3.4.1Mat上仍然冻结
- 计算着色器Open GL ES的多个输入
- 从生成文件编译错误:"Unable to open output file" ..."No such file or directory"
- Open GL ES 3.1 的计算着色器的最小工作示例
- 我可以对"int 文件 = open(path, flag);"做点什么吗?
- 进口。TLB文件给出"cannot open source file x.tlh"
- QtCreator 中的"Fatal Error C1083: Cannot open include file"
- OpenCV: fs.open fails
- Cygwin pkg-config/protobuf filepath issues
- Open AL 的函数在 ubuntu 中使用 g++ 编译时给出未定义引用的错误
- 标准::Ofstream Open的Klocwork问题
- sourceFile.open(filepath);