69,336
社区成员
发帖
与我相关
我的任务
分享
//test.c
#include <stdio.h>
int main() {
int c;
unsigned char uc;
while (1) {
c=fgetc(stdin);
if (EOF==c) break;
uc=(unsigned char)c;
printf("0x%02X ",uc);
}
return 0;
}
//C:\tmp>hexdump ff.dat
//00000000 - 01 02 81 82 ff fe ff ff
//
//C:\tmp>test < ff.dat
//0x01 0x02 0x81 0x82 0xFF 0xFE 0xFF 0xFF
int fgetc(FILE *stream)
int c;
unsigned char uc;
whie (1) {
c=fgetc(stdin);
if (EOF==c) break;
uc=(unsigned char)c;
printf("0x%02X ",uc);
}