#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream infile("filename.txt",ios::in);
while(!infile)
cerr<<"count open the file!";
char ch;
for (int i = 0; (infile.get(ch)) != '\0'; i++)
cout<<ch<<" ";
getchar();
return 0;
}
这个可以读入字符
稍微改一下 就可以了!