标题:这个错误是为啥?怎样改正?
取消只看楼主
冷月·葬花魂
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2017-12-10
结帖率:75%
 问题点数:0 回复次数:0 
这个错误是为啥?怎样改正?
d:\专业\vc6\myprojects\行文本编辑器\行文本编辑器3\linklist.h(66) : error C2664: '__thiscall fstream::fstream(int)' : cannot convert parameter 1 from 'char [12]' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
        d:\专业\vc6\myprojects\行文本编辑器\行文本编辑器3\linklist.h(63) : while compiling class-template member function 'void __thiscall LinkList<char>::Showwenben(void)'
Error executing cl.exe.
代码如下
void Showwenben()//显示当前文本
    {
        cout<<"当前文本是:"<<endl;
        int i,j;
        fstream examplefile("example.txt");//错误行
        for(i=0;i<hang;i++)
        {
            
            for(j=0;j<lie;j++)
            {
                cout<<wenben[i][j];
                if (examplefile.is_open())
                {
                    examplefile<<"wenben[i][j]";
                    
                }
               
            }
            examplefile.close();
            cout<<endl;
        }
    }
};
搜索更多相关主题的帖子: 错误 文本编辑器 int void cout 
2018-06-26 15:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-488175-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.692915 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved