ascii码的fputc出错,而且显示不全

输出1~127的ascii码对应码字char c,有一些字符显示不全,比如7,8,9,13后面是空的。用fputc将它们依次写进文件。

用fgetc读取该文件,并将得到的字符依次显示,
可是到了第26个字符,显示文件结束了!程序结束!这是为什么?
程序非常短小,请帮忙看一下!

#include
#include
using namespace std;
void main(){
char c;
int t=0;
FILE *in,*out;
out=fopen("1.txt","w");
for(int i=0;i<127;i++)
{c=i;
cout<<i<<":"<<c<<endl;
fputc(c,out);
}
system("pause");
fclose(out);

in=fopen("1.txt","r");
while(!feof(in))
{
    c=fgetc(in);
cout<<t<<":"<<c<<endl;
t++;
}
system("pause");
fclose(in);

}

fopen里面的"r"表示用文本方式打开,如果文件不是文本,比如你这种奇怪的字符,就有可能要出问题了,用"rb"二进制方式打开就行了

应该是遇到了不认为是9有效字符的字符了

![![图片说明](https://img-ask.csdn.net/upload/201505/08/1431014532_888603.png)图片说明](https://img-ask.csdn.net/upload/201505/08/1431014524_334758.png)图片说明
ascii码表中有些字符是控制字符,是不可打印字符