Category : C Source Code
Archive   : FLOOK.ZIP
Filename : FLOOK.C

 
Output of file : FLOOK.C contained in archive : FLOOK.ZIP
/* Program Name: FLOOK.C */
/* Description : View a file in HEX and ASCII */

#include "stdio.h"
#include "ctype.h"

#define SIZE 128

char buf[SIZE];
void display();

main(argc, argv)

int argc;
char *argv[];

{
FILE *fp;
int sector, numread;

if (argc!=2) {
printf("Type in at prompt Í> FLOOK filename\n");
exit(1);
}

printf("\nFLOOK : PC File Viewing Utility\n");
printf(" (enter -1 to quit)\n");

if ((fp=fopen(argv[1], "rb"))==NULL) {
printf("File cannot be opened!\n");
exit(1);
}

do {
printf("Sector to View: ");
scanf("%ld", §or);
if (fseek(fp, sector*SIZE, SEEK_SET)) {
printf("Seek Error!\n");
}

if((numread=fread(buf, 1, SIZE, fp)) != SIZE) {
printf("EOF reached!\n");
}

display(numread);
} while(sector>=0);
}

/* display the file */
void display(numread)
int numread;
{
int i,j;

for(i=0; i for(j=0; j<16; j++) printf("%3X", buf[i*16+j]);
printf(" ");
for(j=0; j<16; j++) {
if(isprint(buf[i*16+j])) printf("%c", buf[i*16+j]);
else printf(".");
}
printf("\n");
}
}


  3 Responses to “Category : C Source Code
Archive   : FLOOK.ZIP
Filename : FLOOK.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/