#include #include #include #include"..\lib\7188.h" void main() { int i,j; FILE *stream; char filename[20],tt[20],c1,c2,cc; char buf[256]; printf("\nfilename="); scanf("%s",tt); filename[0]='B'; filename[1]=':'; i=0; while (tt[i]) { filename[i+2]=tt[i]; i++; } filename[i+2]=0; printf("filename=%s",filename); printf("\nPress ALT-S for Download from PC"); stream=fopen(filename,"wb"); j=0; for (;;) { while (kbhit()==0) ; i=getch(); c1=ascii_to_hex(i); if (c1<0) break; if (c1>15) break; while (kbhit()==0) ; i=getch(); c2=ascii_to_hex(i); cc=c1*16+c2; buf[j]=cc; j++; if (j>=256) { fwrite(buf,1,j,stream); j=0; } putch('0'); } if (j>0) fwrite(buf,1,j,stream); fclose(stream); } /* ----------------------------- */ ascii_to_hex(char c) { if (c<='9') return(c-'0'); else return(c-'A'+10); }