25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music

Extract and display images compressed in an ARC512 archive one at a time, DeSmet C

As described more fully in the program comments below, my automated IFS fractal generator program optionally compressed its output images into archives with ARC512.EXE to conserve floppy disk space. 

It was impossible to decompress an entire .ARC file full of images because that, too, would require more disk space than was available.  

This program, after a somewhat involved setup procedure described below, reads the list of image files that are contained in an archive, and extracts and displays them one at a time. 

It is written in DeSmet C for the Heathkit H-100 computer.

/*	browsarc.c    4-29-93
	Copyright (C)1993 Steven Whitney.
	Published under GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY.
	Initially published by http://25yearsofprogramming.com. 

	THIS WAS A HELPER PROGRAM FOR THE AUTORAND PROGRAM, WHICH CREATED COMPRESSED 
	ARCHIVES OF ZED FILES DURING LONG OVERNIGHT RUNS. THIS PROGRAM EXTRACTS THE ZEDS 
	AND DISPLAYS THEM, ALTHOUGH IT REQUIRES THAT THE USER FIRST USE ARC512.EXE TO CREATE 
	A TEXT FILE THAT LISTS THE CONTENTS OF THE ARC FILE. WHEN THE H100 WAS MY ONLY COMPUTER, 
	EVEN THIS LEVEL OF AUTOMATION WAS VERY HANDY, BUT IF YOU DEVELOP A FASCINATION FOR THE 
	DESIGNS THAT AUTORAND CREATES, YOU'D BE BETTER OFF USING ONE OF AUTORAND'S LATER VERSIONS 
	ON A FASTER COMPUTER WITH A LARGER DISK CAPACITY.  

	THE REASON THIS PROGRAM WAS SO USEFUL AT THE TIME WAS THAT EACH ZED FILE WAS 56000 BYTES, 
	SO ONLY A FEW WOULD FIT ON AN H100 DISK. BUT ZED FILES ACHIEVE VERY HIGH COMPRESSION IN ARCS, 
	ALLOWING THE AUTOMATIC SAVING OF DOZENS OF THEM. BUT TO VIEW THEM, YOU STILL CAN'T EXTRACT 
	THEM ALL, BECAUSE THEY STILL WON'T ALL FIT ON ONE DISK. SO THIS PROGRAM EXTRACTS AND 
	DISPLAYS THEM ONE AT A TIME.

	UNPACKS AND DISPLAYS ALL .ZIC OR .ZED FILES IN AN .ARC FILE.
	PROGRAM REQUIRES THAT THE .ARC FILE HAVE AN ASSOCIATED TEXT FILE
	LISTING OF ITS CONTENTS, WITH THE SAME NAME, CREATED WITH THE ARC512 "L" COMMAND (SEE BELOW).
	E.G. ZICS.ARC WOULD REQUIRE THE TEXT FILE ZICS.DIR IN THE SAME DISK DIRECTORY.

	PROGRAM ALSO REQUIRES THAT ARC512.EXE AND DISPSING.EXE BE IN THE DEFAULT DIRECTORY.

	Bind with:  BIND EXEC BROWSARC MYLIB.S -OBROWSARC
*/

#include "stdio.h"

main(argc,argv)
int argc;
char **argv;
{
char buf[80];				
char cmdtail[80];
char tbuf[80];
FILE *infile;

if(argc < 2)
{
	puts("Usage:  BROWSARC FILE (file is .ARC file, without extension)\n\n");
	puts("Program requires that the default directory contain\n");
	puts("ARC512.EXE and DISPSING.EXE.\n\n");
	puts("The disk directory containing the .ARC file must also have an\n");
	puts("associated file listing the archive contents: ZEDS.ARC requires ZEDS.DIR.\n");
	puts("Create the directory file with: ARC512 L ZEDS *.ZED > ZEDS.DIR.\n");
	puts("Then edit out of ZEDS.DIR all text that isn't the file list.\n\n");
	exit(0);
}
if((infile = fopen("ARC512.EXE","r"))==NULL)					/* test for */
	abort("ARC512.EXE must be in the default directory.");		/* required */
else fclose(infile);
if((infile = fopen("DISPSING.EXE","r"))==NULL)					/* external */
	abort("DISPSING.EXE must be in the default directory.");	/* programs */
else fclose(infile);

sprintf(buf,"%s.DIR",argv[1]);		/* set up .ARC directory file name */
if((infile = fopen(buf,"r"))==NULL)
	abort("Cannot open directory file");		

puts("Press 'Q' (several times) to quit early.\n");
puts("\033x<\033y@");				/* disable auto-repeat & event mode */

/* below: read file names & test for user wants to quit */
while((fgets(tbuf,80,infile) != NULL) && (tolower(csts()) != 'q'))
{									
	sscanf(tbuf,"%s",buf);			/* put .ZIC/.ZED file name in buf */
	sprintf(cmdtail," x %s %s",argv[1],buf);	/* create command tail */
	exec("arc512.exe",cmdtail);		/* EXTRACT THE ARCHIVED FILE */
	exec("dispsing.exe",buf);		/* DISPLAY THE IMAGE */
	unlink(buf);					/* THEN ERASE IT FROM DISK */
}
fclose(infile);
puts("\033z");						/* reset terminal */
exit(0);
}

 

 

Valid HTML 4.01 Transitional Valid CSS
Yahoo! Search
Search the web Search this site
View content labeling at ICRA.