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

C++文件读取(含空格和回车) #include;
#include;
#include;

#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); //取消c++ cin输入流默认的忽略空白字符,也就是不再忽略空白字符


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


        return 0;

}

原文地址如下:

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

感谢原作者cyclone



你可能感兴趣的:(C++文件读取(含空格和回车) --转载)