campo-sirio/al/examples/ex07con.c
alex 714dd74636 Archive Library versione 2.00
git-svn-id: svn://10.65.10.50/trunk@5350 c028cbd2-c16b-5b4b-a496-9718f37d4682
1997-10-09 16:09:54 +00:00

70 lines
1.9 KiB
C
Executable File

/*
* EX07CON.C
*
* C/DOS Example program for ArchiveLib 2.0
*
* Copyright (c) Greenleaf Software, Inc. 1994 - 1996
* All Rights Reserved
*
* MEMBERS/FUNCTIONS DEMONSTRATED
*
*
* 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 <stdio.h>
#include <string.h>
#include <direct.h>
#include <conio.h>
#include "al.h"
int main()
{
hALArchive archive;
hALMonitor monitor;
hALEntryList list;
hALEntry entry;
printf( "Archive Library 2.0\nEX07CON.C\n\n" );
printf( "This example program extracts files from dos00.gal, and puts them\n" );
printf( "in a new subdirectory called TEMP. In order to make the files\n" );
printf( "go to the subdirectory, we have to walk through the entry list and\n" );
printf( "change the name of each and every object so it includes the\n" );
printf( "TEMP\\ directory specification.\n\n" );
getch();
monitor = newALBarGraph( AL_MONITOR_OBJECTS );
#if defined( ZIP )
archive = newALPkArchive( "dos00.zip" );
list = newALListPkDecompressFileTools( monitor );
#else
archive = newALGlArchive( "dos00.gal" );
list = newALListGlDecompressFileTools( monitor );
#endif
mkdir( "temp" );
ALArchiveReadDirectory( archive, list );
entry = ALEntryListGetFirstEntry( list );
while ( entry ) {
char name[ 132 ];
strcpy( name, "temp\\" );
strcat( name, ALStorageGetName( ALEntryGetStorage( entry ) ) );
printf( "New name: %s\n", name );
ALStorageSetName( ALEntryGetStorage( entry ), name );
entry = ALEntryGetNextEntry( entry );
}
return ALArchiveExtract( archive, list );
}