\t\tC++文件读取(含空格和回车) --转载

来源:互联网 发布:axure rp8 mac破解版 编辑:程序博客网 时间:2024/06/02 04:53
C++文件读取(含空格和回车)  
#include<fstream.h>;
#include<iostream.h>;
#include<string.h>;

#define filename "c:\\aa.bat"

int main()
{
        ifstream fin;
        fin.open(filename);
        if(!fin)
        {
                cout<<"Error...\n";
                return 0;
        }

        char ch;
        cin.unsetf(ios::skipws);


        do
        {
                fin.get(ch);
                cout<<ch;
        }while(!fin.eof());


        return 0;

}

原文地址如下:

http://blog.sina.com.cn/s/blog_60ffc4670100mr9p.html

感谢原作者cyclone



原创粉丝点击