조건 : 실제 HEX에디터와 똑같이 불러와야 함(모양은 WINHEX 기반으로)
자료구조는 이중 링크드 리스트 이용
최종목표 : 검색, 비교, 수정 가능한 헥사 에디터 제작 / PE구조도 한눈에 볼 수 있도록
나중에 프로그래밍 여건이 되면 하자 ;;-_-
2008년 11월 15일
- 파일을 16진수로 읽어와서 콘솔 화면에 출력
#include <stdio.h>
#include <conio.h>
int main(void)
{
FILE *fp;
int count=0;
unsigned char i=0;
char buf[80];
if( (fp=fopen("c:english.exe","rb")) == NULL )
{
printf("file not found");
return 0;
}
while(feof(fp) == 0)
{
fread(&i,1,1,fp);
if(count%16 == 0 )
{
printf("n %08X : ",count);
}
if(count%8 == 0 )
{
printf(" ");
}
count++;
printf("%02X ",i);
if(count%(256+128) == 0)
{
//getch();
}
i=0;
}
printf("nFile Size is %d [%x]",count-1,count-1);
fclose(fp);
return 0;
}