Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. <syntaxhighlight lang="cpp"> bool ControllerClass::SaveGameDataToFile(const FString& FullFilePath, FBufferArchive& ToBinary) { //note that the supplied FString must be the entire Filepath // if writing it out yourself in C++ make sure to use the \\ // for example:
  2.  
  3. // FString SavePath = "C:\\MyProject\\MySaveDir\\mysavefile.save";
  4.  
  5. //Step 1: Variable Data -> Binary
  6.  
  7. //following along from above examples SaveLoadData(ToBinary,NumGemsCollected,PlayerLocation,ArrayOfRotationsOfTheStars); //presumed to be global var data, //could pass in the data too if you preferred
  8.  
  9. //No Data if(ToBinary.Num() <= 0) return false; //~
  10.  
  11. //Step 2: Binary to Hard Disk if (FFileHelper::SaveArrayToFile(ToBinary, * FullFilePath)) { // Free Binary Array ToBinary.FlushCache(); ToBinary.Empty();
  12.  
  13. ClientMessage("Save Success!"); return true; }
  14.  
  15. // Free Binary Array ToBinary.FlushCache(); ToBinary.Empty();
  16.  
  17. ClientMessage("File Could Not Be Saved!");
  18.  
  19. return false; } </syntaxhighlight>
  20.  
  21. FBufferArchive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement