_________________________________main_________________________________
#include <stdio.h>
#include <process.h>
#include "hexaview.h"
int main(int argc, char *argv[])
{
FILE *fp;
unsigned char RData[512]={0};
unsigned int count = 0;
unsigned int count2 = 0;
unsigned int iSum = 0;
if(argc != 2)
{
printf("Conmmand parameter not correct!\n");
exit(-1);
}
if((fp = fopen (argv[1], "r")) == NULL)
{
printf("Can not open file %s\n", argv[1]);
exit(-1);
}
fflush(stdin);
//while((RData[count] = getc(fp)) != EOF)//255
while( 0 == feof(fp))
{
RData[count] = getc(fp);
++count;
++iSum;
if(count >= sizeof(RData))
{
hexaview(RData, count);
count = 0;
printf("계속하려면아무키나 누르시오...\n");
getchar();
fflush(stdin);
}
}
if(iSum > 512)
{
count2 = count;
while(count < sizeof(RData))
{
RData[count-1] = 0;
++count;
}
hexaview(RData, count2);
printf("file %s contains %d characters.\n", argv[1], iSum);
}
else
{
RData[count-1] = 0;
hexaview(RData, count);
printf("file %s contains %d characters.\n", argv[1], count);
}
fclose(fp);
return 0;
}
______________________________________________________________________
실행결과
___________________test2.dat__________________________
Good Great Amazing Marvellous Excellent Awesome
Attractive Qurious Fantastic Elegant Astonishing
Gorgeous Fascinating Lovesome Sensational Qurious
Fancy Pitapatting pi pitapatting Tremble Tremble
Tremble I I I love you I I I love you
Attractive Qurious Qurious
Good Great Amazing Marvellous Excellent Awesome
Attractive Qurious Fantastic Elegant Astonishing
Gorgeous Fascinating Lovesome Sensational Qurious
Fancy Pitapatting pi pitapatting Tremble Tremble
Tremble I I I love you I I I love you
Attractive Qurious Qurious
Good Great Amazing Marvellous Excellent Awesome
Attractive Qurious Fantastic Elegant Astonishing
Gorgeous Fascinating Lovesome Sensational Qurious
Fancy Pitapatting pi pitapatting Tremble Tremble
Tremble I I I love you I I I love you
Attractive Qurious Qurious
Good Great Amazing Marvellous Excellent Awesome
Attractive Qurious Fantastic Elegant Astonishing
Gorgeous Fascinating Lovesome Sensational Qurious
Fancy Pitapatting pi pitapatting Tremble Tremble
Tremble I I I love you I I I love you
Attractive Qurious Qurious
Good Great Amazing Marvellous Excellent Awesome
Attractive Qurious Fantastic Elegant Astonishing
Gorgeous Fascinating Lovesome Sensational Qurious
Fancy Pitapatting pi pitapatting Tremble Tremble
Tremble I I I love you I I I love you
Attractive Qurious Qurious
Good Great Amazing Marvellous Excellent Awesome
Attractive Qurious Fantastic Elegant Astonishing
Gorgeous Fascinating Lovesome Sensational Qurious
Fancy Pitapatting pi pitapatting Tremble Tremble
Tremble I I I love you I I I love you
Attractive Qurious Qurious END OF FILE.
____________________________________________________
'코스웨어 > 13년 스마트컨트롤러' 카테고리의 다른 글
언젠가 쓸지도 모르는 vi에디터 사용법 (6) | 2013.05.04 |
---|---|
5월 3일 정리--문예진 (20) | 2013.05.03 |
파일 읽고, 배열[512]만큼 Hexaview 띄우기 [손초롱] (0) | 2013.05.03 |
[숙제]hexaview---문예진 (2) | 2013.05.03 |
헥사뷰어_석주원 (0) | 2013.05.03 |
Hexa viewer 과제 - 변준식 (0) | 2013.05.03 |
[과제제출]hexaview 0503 - 이수현 (0) | 2013.05.03 |
2013-04-30 정리 - 전영기 (14) | 2013.05.03 |