39 lines
820 B
C++
39 lines
820 B
C++
|
|
||
|
#include "arclib.h"
|
||
|
#if !defined( AL_IBM )
|
||
|
#pragma hdrstop
|
||
|
#endif
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include "alsimple.h"
|
||
|
|
||
|
//
|
||
|
// I want to modify a ZIP file so that it
|
||
|
// extracts all its files into a temp directory.
|
||
|
//
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
int i;
|
||
|
struct ALZipDir *z;
|
||
|
char *p;
|
||
|
|
||
|
z = ALReadDir( "libs.zip", 0, 0 );
|
||
|
if ( z != 0 ) {
|
||
|
for ( i = 0 ; z[ i ].size != -1 ; i++ ) {
|
||
|
p = new char[ ( strlen( z[ i ].name ) + 10 ) ];
|
||
|
strcpy( p, "temp\\" );
|
||
|
strcat( p, z[ i ].name );
|
||
|
ALSetName( z + i, p );
|
||
|
delete[] p;
|
||
|
ALSetComment( z + i, "Modified path" );
|
||
|
}
|
||
|
ALWriteDir( z );
|
||
|
ALFreeDir( z );
|
||
|
} else
|
||
|
cout << "Error reading zip file directory\n";
|
||
|
return 0;
|
||
|
}
|
||
|
|