#include <v_lib.h>

file_t	V_GLOBAL
gzConvertToDecompress(file_t in);

int main()
{
	void_p mem;
	file_t in,de,out;
	logStartConsoleLog();
	logUpperLevel(LOG_TRACE);
	in=fileOpenRead("test.txt.gz");
	de=gzConvertToDecompress(in);
	if(!de)
	{
		fileClose(in);
		puts("main(): gzConvertToDecompress() failed");
		return -1;
	}
	/* At this moment 'in' already closed */
	printf("Size of decompressed file: %u\n",fileSize(de));
	out=fileOpenWrite("out.txt");
	fileControl(de,pctl_map_ispace,&mem);
	fileWrite(out,mem,fileSize(de));
	fileClose(out);
	fileClose(de);
		
	memPrintMemStats();
	memPrintObjStats();
	
	return 0;
}

