Wiki Code Tutorials

[=Markyroson;348427]
how would you go about decompressing the file and then loading the saved info?
[/]

I show you how to decompress and load the data in section of my Binary Save System wiki:

Loading Compressed Binary Data
https://wiki.unrealengine./Save_System,Read%26_Write_Any_Data_to_Compressed_Binary_Files#Loading_Compresse


**C++ Code For You**

Here's the code most relevant to your question:



```


//Load the Compressed data array
	TArray<uint8> CompressedData;
	if (!FFileHelper::LoadFileToArray(CompressedData, *FullFilePath))
	{
		Optimize("FFILEHELPER:>> Invalid File");
		return false;
		//~~
	}
 
	// Decompress File 
	FArchiveLoadCompressedProxy Decompressor = 
		FArchiveLoadCompressedProxy(CompressedData, ECompressionFlags::COMPRESS_ZLIB);
 
	//Decompression Error?
	if(Decompressor.GetError())
	{
		Optimize("FArchiveLoadCompressedProxy>> ERROR : File Was Not Compressed ");
		return false;
		//
	}
 
	//Decompress
	FBufferArchive DecompressedBinaryArray;
	Decompressor << DecompressedBinaryArray;
 
	//~
	//		  Read the Data Retrieved by GFileManager
	//~
 
	FMemoryReader FromBinary = FMemoryReader(DecompressedBinaryArray, true); //true, free data after done
	FromBinary.Seek(0);

	SaveLoadData(FromBinary,NumGemsCollected,PlayerLocation,ArrayOfRotationsOfTheStars);


```



SaveLoadData uses the Memory Reader Archive to put the supplied data back in the variables, which are passed in by reference.

You could also pass in a UStruct or an actor that was spawned and then fill in the appropriate variable data that way!

Enjoy!

:)