Category : Word Processors
Archive   : DUMP2.ZIP
Filename : DUMP.C
#include
#include
#include
unsigned char buf[256];
void display();
main()
{
FILE *fp1;
FILE *fp2;
int numread, sector = 0, liner;
char name1[24];
char name2[24];
int size = 128;
char are_two = 1;
printf("Dump two files at once and compare one above ");
printf("the other, or just dump one\n\n");
printf("enter the 1st file name: ");
gets(name1);
printf("enter the 2nd file name: ");
gets(name2);
if (name2[0] == NULL) {
are_two = 0;
size = 256;
}
_clearscreen(_GCLEARSCREEN);
do {
_clearscreen(_GCLEARSCREEN);
if (sector >= 0) {
for (liner = 0; liner <= 79; liner ++)
printf("%c",219);
printf(" filename: %.12s offset: %d ",
name1,(sector * size));
printf("\n");
if ((fp1 = fopen(name1, "rb")) == NULL) {
printf("can not open file\n");
exit(1);
}
if( fseek(fp1, (long) sector*size, SEEK_SET)) {
printf("seek error\n");
}
if ((numread = fread(buf, 1, size, fp1)) != size) {
printf("EOF reached\n");
}
display(numread);
fclose(fp1);
if (! are_two) {
printf("\n");
for (liner = 0; liner <= 79; liner ++)
printf("%c",219);
}
/* start reading second file if used */
if (are_two) {
printf("\n");
for (liner = 0; liner <= 79; liner ++)
printf("%c",219);
printf(" filename: %.12s offset: %d ",
name2,(sector * size));
printf("\n");
if ((fp2 = fopen(name2, "rb")) == NULL) {
printf("can not open file\n");
exit(1);
}
if( fseek(fp2, (long) sector*size, SEEK_SET)) {
printf("seek error\n");
}
if ((numread = fread(buf, 1, size, fp2)) != size) {
printf("EOF reached\n");
}
display(numread);
fclose(fp2);
printf("\n");
for (liner = 0; liner <= 79; liner ++)
printf("%c",219);
}
}
printf("
sector = new_sector(sector);
} while (sector >= 0);
}
/* Display the contents of a file */
void display(int numread)
{
int i, j;
for (i = 0; i < numread /16; i++) {
for (j = 0; j < 16; j++) {
if (buf[i *16 + j] >= 0 && buf[i *16 + j] <=15)
printf("%c",'0');
printf("%X ", buf[i * 16 + j]);
}
printf(" ");
printf(" %c ",219);
for (j = 0; j < 16; j++) {
if (isspace(buf[i * 16 + j]) || buf[i * 16 + j] == NULL) printf(".");
else printf("%c" , buf[i * 16 +j]);
}
printf("\n");
}
}
/* see if Pgup, pgdn or esc was hit */
int new_sector(new_sect)
int new_sect;
{
int imp_key1, imp_key2;
do {
imp_key1 = 0;
imp_key2 = 0;
imp_key1 = getch();
if (imp_key1 == 0) {
imp_key2 = getch();
switch (imp_key2) {
case 81:
++new_sect;
break;
case 73:
--new_sect;
}
}
if (new_sect <= 0) new_sect = 0;
} while (imp_key1 != 27 && imp_key2 != 81 && imp_key2 !=73);
if (imp_key1 == 27) return(-1);
else return(new_sect);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/