76 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//
 | 
						|
// EX03CON.CPP
 | 
						|
//
 | 
						|
//  C++/DOS Example program for ArchiveLib 2.0
 | 
						|
//
 | 
						|
//  Copyright (c) Greenleaf Software, Inc. 1994 - 1996
 | 
						|
//  All Rights Reserved
 | 
						|
//
 | 
						|
// MEMBERS/FUNCTIONS DEMONSTRATED
 | 
						|
//
 | 
						|
//   ALArchiveBase::Delete()
 | 
						|
//   ALEntry::GetNextEntry()
 | 
						|
//   ALEntry::SetMark()
 | 
						|
//   ALEntryList::GetFirstEntry()
 | 
						|
//
 | 
						|
// DESCRIPTION
 | 
						|
//
 | 
						|
//  This example program takes the existing DOS00.GAL archive (create it
 | 
						|
//  with EX00CON if you don't have it) and deletes every other entry.
 | 
						|
//  Note that when we call Delete(), we specify an Archive with an empty
 | 
						|
//  name, which causes ALArchiveBase::Delete() to rename the input to a
 | 
						|
//  backup, and rename the output to the original input name.  Clear?
 | 
						|
//
 | 
						|
// 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 "filestor.h"
 | 
						|
 | 
						|
main()
 | 
						|
{
 | 
						|
 cout << "Archive Library 2.0\nEX03CON.CPP\n\n";
 | 
						|
 cout << "This example program takes the existing DOS00.GAL archive (create it\n";
 | 
						|
 cout << "with EX00CON if you don't have it) and deletes every other entry.\n";
 | 
						|
 cout << "Note that when we call Delete(), we specify an Archive with an empty\n";
 | 
						|
 cout << "name, which causes ALArchiveBase::Delete() to rename the input to a\n";
 | 
						|
 cout << "backup, and rename the output to the original input name.\n";
 | 
						|
 getch();
 | 
						|
 | 
						|
 ALBarGraph monitor( AL_MONITOR_OBJECTS, cout );
 | 
						|
 long total = 0;
 | 
						|
 | 
						|
#if defined( ZIP )
 | 
						|
 ALEntryList list( &monitor, PkDecompressTools() );
 | 
						|
 ALPkArchive archive( "dos00.zip" );
 | 
						|
 ALPkArchive temp( "" );
 | 
						|
#else
 | 
						|
 ALEntryList list( &monitor, GlDecompressTools() );
 | 
						|
 ALGlArchive archive( "dos00.gal" );
 | 
						|
 ALGlArchive temp( "" );
 | 
						|
#endif
 | 
						|
 cout << "\nDeleting every other object from "
 | 
						|
      << archive.GetStorageObject()->mName.GetSafeName()
 | 
						|
      << "."
 | 
						|
      << endl;
 | 
						|
 | 
						|
 archive.ReadDirectory( list );
 | 
						|
 ALEntry *entry = list.GetFirstEntry();
 | 
						|
 list.ClearMarks();
 | 
						|
 while ( entry ) {
 | 
						|
     total++;
 | 
						|
     if ( total % 2 )
 | 
						|
         entry->SetMark();
 | 
						|
     entry = entry->GetNextEntry();
 | 
						|
 }
 | 
						|
 archive.Delete( list, temp );
 | 
						|
 return 1;
 | 
						|
}
 |