69,382
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#define draw '#'
#define x_origin 10
#define word_byte 2*16
void mygotoxy(int x,int y)
{
while(y--)
{printf("\n");}
while(x--)
{printf(" ");}
}
void hdz(int byte_dz)
{
int byte_bit_num=8;
while(byte_bit_num--)
{
if (byte_dz&0x80)
{
printf("%c",draw);
}
else
{
printf(" ");
}
byte_dz=byte_dz<<1;
}
}
int main(void)
{
int x=x_origin,y=5;
char buf[512],byte_dz,byte_bit_num=8;
int word_byte_i=0,show_i=0,word_origin=2*16*0,byte_dz_i=word_origin;
FILE *fp;
if (!(fp = fopen(".\\hzk16","rb")))
{
printf("open file fail\n");
}
fseek(fp,+word_byte*1500,SEEK_SET);
printf("ftell=0x%x\n",ftell(fp));
getch();
fread(buf,word_byte*5,1,fp);
while(show_i<word_byte*5)
{
while(word_byte_i++<word_byte)
{
printf("%x ",buf[show_i++]);
}
printf("\n");
word_byte_i=0;
}
getch();
system("cls");
mygotoxy(x,y);
while(byte_dz_i<(word_origin+word_byte))
{
byte_dz=buf[byte_dz_i++];
hdz(byte_dz);
byte_dz=buf[byte_dz_i++];
hdz(byte_dz);
printf("\n");
x=x_origin;
while(x--)
{printf(" ");}
}
getch();
fclose(fp);
return 0;
}
#include <stdio.h>
#define draw '#'
#define x_origin 10
#define word_byte 2*16
void mygotoxy(int x,int y)
{
while(y--)
{printf("\n");}
while(x--)
{printf(" ");}
}
void hdz(char byte_dz)
{
int byte_bit_num=8;
while(byte_bit_num--)
{
if (byte_dz&0x80)
{
printf("%c",draw);
}
else
{
printf(" ");
}
byte_dz=byte_dz<<1;
}
}
int main(void)
{
int x=x_origin,y=5;
char buf[512],byte_dz,byte_bit_num=8;
int word_byte_i=0,show_i=0,word_origin=2*16*0,byte_dz_i=word_origin;
FILE *fp;
if (!(fp = fopen(".\\hzk16","rb")))
{
printf("open file fail\n");
}
fseek(fp,+word_byte*1500,SEEK_SET);
printf("ftell=0x%x\n",ftell(fp));
getch();
fread(buf,word_byte*5,1,fp);
while(show_i<word_byte*5)
{
while(word_byte_i++<word_byte)
{
printf("%x ",buf[show_i++]);
}
printf("\n");
word_byte_i=0;
}
getch();
system("cls");
mygotoxy(x,y);
while(byte_dz_i<(word_origin+word_byte))
{
byte_dz=buf[byte_dz_i++];
hdz(byte_dz);
byte_dz=buf[byte_dz_i++];
hdz(byte_dz);
printf("\n");
x=x_origin;
while(x--)
{printf(" ");}
}
getch();
fclose(fp);
return 0;
}