بلغه C
#include <stdio.h>
#include <stdlib.h>
#define BITS 0xc
#define FILENAME "filename here"
static
void output(unsigned char char1, unsigned char char2){
printf("%02x %02x\n", char1, char2);
}
void readFile(char *filename){
unsigned char rd;
FILE *file=fopen(filename, "rb");
if(!file){
printf("error open file (%s)\n", filename);
return;
}
fseek(file, 0, SEEK_SET);
while(!feof(file)){
rd=(char)fgetc(file);
output((rd&0xf0)|BITS, ((rd&15)<<4)|BITS);
}
}
int main(int argc, char** argv) {
readFile(FILENAME);
return (EXIT_SUCCESS);
}