当前位置:编程学习 > C#/ASP.NET >>

写了一个读取文件的类但是读不到里面内容 也没有报错 求指导下什么原因

#include <iostream>  
#include <fstream>  
#include <sstream>  
#include <algorithm>  
#include <numeric>  
#include <iterator>  
#include <map>
#include <string>
using namespace std;
class Filhost{
public:
Filhost(const char *txt){
ifstream test(txt);
txtlist();
}
void lget(){
cout<<textline<<endl;
}
private:
ifstream test;
string textline;
void txtlist(){
string w;
while(getline(test,w)){
cout<<w<<endl;
}
}
};
void main(){
Filhost f("E:\\host.txt");
f.lget();
}

代码如上 问题如题 c++ 类 --------------------编程问答-------------------- 先把语法学好 --------------------编程问答-------------------- 再都说两句,
把类成员变量,函数的局部变量,变量的生存期搞清楚
补充:.NET技术 ,  VC.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,