campo-sirio/al/examples/ex26con.cpp

47 lines
1007 B
C++
Raw Normal View History

#include "arclib.h"
#if !defined( AL_IBM )
#pragma hdrstop
#endif
#include <stdlib.h>
#include <stdio.h>
#include "alsimple.h"
#if defined( AL_BORLAND )
#include <dir.h>
#else
#include <direct.h>
#endif
void my_callback( const char AL_DLL_FAR *name,
int object_ratio,
int job_ratio )
{
if ( name )
cout << "\n" << name << " ";
if ( object_ratio >= 0 ) {
char buf[ 24 ];
sprintf( buf, "%d%% %d%%", object_ratio, job_ratio );
cout << " \b\b\b\b\b\b\b\b\b\b" << buf;
for ( int i = 0 ; i < (int) strlen( buf ) ; i++ )
cout << '\b';
}
}
main()
{
struct ALZipDir *z;
chdir( "temp" );
fopen( "test.xxx", "wb" );
z = ALReadDir( "..\\libs.zip", 0, 0 );
if ( z != 0 ) {
ALExtract( z, 0, my_callback );
ALFreeDir( z );
} else
cout << "Error reading zip file directory\n";
chdir( ".." );
return 0;
}