一个ifstream 打开文件的错误
时间:2011-12-12
来源:互联网
C/C++ code
请大牛指教
void bayes() { ifstream infile("ls-train.txt"); ifstream input; if(!infile) { cout << "dict open error "<<endl; } string word; string filename; char *temp = (char *)malloc(sizeof(char) * 10) ; int i = 1; int type; /*这一步 是统计每一分类 ,他每个单词出现的次数*/ while(infile >> filename) { //strcpy(temp,filename.c_str()) ; //type = temp[0] - '0'; [color=#FF0000] input( filename.c_str() ); //这一步报错 : no match for call to ‘(std::ifstream) (const char*)[/color] if( ! input) ; cout << filename << " open error" << endl; input.close(); } infile.close();
请大牛指教
作者: fx397993401 发布时间: 2011-12-12
没有你那样的函数调用...
input( filename.c_str() ); // input是一个对象,你这样写,不知是什么含义?
input( filename.c_str() ); // input是一个对象,你这样写,不知是什么含义?
作者: yaningfan 发布时间: 2011-12-12
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28