All pastes #1183003 Raw Edit

Miscellany

public cpp v1 · immutable
#1183003 ·published 2008-08-24 07:27 UTC
rendered paste body
int OpenZIP( FILE* zip_file ) {	int length;	byte* buffer;	// grab file length.	fseek( zip_file, 0, SEEK_END );	length = ftell( zip_file );	// set allocate size of buffer	buffer = new byte[ length + 1 ];	// go back to the beginning.	fseek( zip_file, SEEK_SET, 0 );	// copy contents into buffer	fread( buffer, 1, length, zip_file );	if ( buffer[0] == 0x50 && buffer[1] == 0x4B && buffer[2] == 0x03 && buffer[3] == 0x04 ) {		// Working with a zip		printf( "length: %ibytes\n", length );	}	// delete buffer from memory.	delete buffer;	return 1; // success}