注册 登录
编程论坛 C++教室

很怪异的问题~~16进输出问题

nexus88 发布于 2007-01-08 23:53, 457 次点击

void WriteBinZ()
{
int cc;
FILE *gp;
gp=fopen("TTTTT29.bin","w+"); //建立一个BIN文件
scanf("%x",&cc); //以16进输入
fputc(cc,gp); //打到文件里去
}

大家帮我看下 为什么 输入A或者 0A 只要有A 时 输出结果变0D了?很怪异的

1 回复
#2
yvtianzll2007-01-13 14:00
fputc :Writes a character to a stream

eg: if you call it like this: fput(66,gp), at first ,it change the integer(66) to a character (c),then write c to the file.
so you will find there is a c in your file.
1