67 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			67 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//
 | 
						|
// EX07CON.CPP
 | 
						|
//
 | 
						|
//  C++/DOS Example program for ArchiveLib 2.0
 | 
						|
//
 | 
						|
//  Copyright (c) Greenleaf Software, Inc. 1994 - 1996
 | 
						|
//  All Rights Reserved
 | 
						|
//
 | 
						|
// MEMBERS/FUNCTIONS DEMONSTRATED
 | 
						|
//
 | 
						|
//   ALArchiveBase::Extract()
 | 
						|
//   ALName::ALName()
 | 
						|
//   ALName::operator=()
 | 
						|
//   ALName::operator+()
 | 
						|
//
 | 
						|
// DESCRIPTION
 | 
						|
//
 | 
						|
//  This example program extracts files from DOS00.GAL, and puts them
 | 
						|
//  in a new subdirectory called TEMP.  In order to make the files
 | 
						|
//  go to the subdirectory, we have to walk through the entry list and
 | 
						|
//  change the name of each and every object so it includes the
 | 
						|
//  TEMP\ directory specification.
 | 
						|
//
 | 
						|
// REVISION HISTORY
 | 
						|
//
 | 
						|
//  February 1, 1996  2.0A  : Second release
 | 
						|
//
 | 
						|
 | 
						|
#include <conio.h>
 | 
						|
 | 
						|
#include "arclib.h"
 | 
						|
#include "glarc.h"
 | 
						|
#include "pkarc.h"
 | 
						|
#include "bargraph.h"
 | 
						|
#include <direct.h>
 | 
						|
 | 
						|
main( int, char *[] )
 | 
						|
{
 | 
						|
 cout << "Archive Library 2.0\nEX07CON.CPP\n\n";
 | 
						|
 cout << "This example program extracts files from DOS00.GAL, and puts them\n";
 | 
						|
 cout << "in a new subdirectory called TEMP.  In order to make the files\n";
 | 
						|
 cout << "go to the subdirectory, we have to walk through the entry list and\n";
 | 
						|
 cout << "change the name of each and every object so it includes the\n";
 | 
						|
 cout << "TEMP\\ directory specification.\n\n";
 | 
						|
 getch();
 | 
						|
 | 
						|
 ALBarGraph monitor( AL_MONITOR_OBJECTS, cout );
 | 
						|
#if defined( ZIP )
 | 
						|
 ALPkArchive archive( "dos00.zip" );
 | 
						|
 ALEntryList list( &monitor, PkDecompressTools() );
 | 
						|
#else
 | 
						|
 ALGlArchive archive( "dos00.gal" );
 | 
						|
 ALEntryList list( &monitor, GlDecompressTools() );
 | 
						|
#endif
 | 
						|
 | 
						|
 mkdir( "temp" );
 | 
						|
 archive.ReadDirectory( list );
 | 
						|
 ALEntry *entry = list.GetFirstEntry();
 | 
						|
 while ( entry ) {
 | 
						|
     ALName name = entry->mpStorageObject->mName;
 | 
						|
     name = ALName( "temp\\" ) + (const char *) name;
 | 
						|
     entry->mpStorageObject->mName = name;
 | 
						|
     entry = entry->GetNextEntry();
 | 
						|
 }
 | 
						|
 return archive.Extract( list );
 | 
						|
}
 |