标题:怎么把读入文档写在构造函数中?
取消只看楼主
bluegirlhere
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2013-4-7
结帖率:100%
已结贴  问题点数:20 回复次数:3 
怎么把读入文档写在构造函数中?
fstream newsFile;
  newsFile.open("I:\\NewBrowserText.txt");
2013-04-12 21:41
bluegirlhere
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2013-4-7
得分:0 
谢谢。我刚刚调的是这样的。成功了。
class txtRead{
private:
    fstream newsFile;
    int rows;
    int cols;
    char news;
public:
    void printTxt();
    void countNum();
    txtRead();
};

txtRead::txtRead(){
    newsFile.open("I:\\NewBrowserText.txt");
    if(!newsFile){
        cout<<"you get wrong file's address!"<<endl;
    }
}
2013-04-12 22:21
bluegirlhere
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2013-4-7
得分:0 
回复 楼主 bluegirlhere
谢谢
2013-04-12 22:23
bluegirlhere
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2013-4-7
得分:0 
回复 2楼 邓士林
谢谢o(≧v≦)o~~好棒
2013-04-12 22:25



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




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

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