All pastes #970586 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-04 03:46 UTC
rendered paste body
#include <stdio.h>

struct basehdr_t
{
	int id;
	int version;
};

int main( int argc, char **argv )
{
	FILE *fp = fopen( argv[1], "rb" );
	basehdr_t *phdr = new basehdr_t;
	fread( phdr, 1, 8, fp ); //only bother reading 8 bytes, it's all we need to get the version.
	fclose( fp );
	
	printf( "Version: %i\n", phdr->version );
	
	delete phdr;
	return 0;
}