为什么从文件流里读取字符时,空格和回车都没有了?
如题!
include <iostream>
using namespace std;
#include <stdlib.h>
#include <fstream>
int main(int argc, char *argv[])
{
char gotChar;
int ch;
ifstream inStream("cifa.cpp");
if(!inStream)//inStream.fail();
{
cerr<<"Sorry!";
exit(1);
}
else
{
/**************开始程序的读取****************/
while((ch=inStream.peek())!=EOF)
{
inStream>>gotChar;
cout<<gotChar;
}
/********************************************/
}
return 0;
}
上面的程序为什么不能输出空格,空格到底能不能读到?