Module for Pickling objects in C++.
For Downloading zip file Click Here .
This Pickle class can't pickle the object of those class which contain pointers as their data Members or Attributes like vector, string etc.
For More Click Here .
- Clone or download
the
repo, and then, - Paste the header files pickle.h and pickleException.h in your program directory where your
source.cppfile is present. - Include
pickleheader file in yoursource.cppfile like#include"pickle.h".
#include<iostream>
#include<array>
#include"pickle.h"
using namespace std;
int main()
{
std::array<int,100> myArray;
for (int i = 0; i < 100; i++)
myArray[i] = i*i;
for (auto i : myArray)
cout << i << endl;
usa::Pickle pickle;
pickle.dump("output",myArray);
return 0;
}#include<iostream>
#include<array>
#include"pickle.h"
using namespace std;
int main()
{
std::array<int, 100> myNewArray;
usa::Pickle pickle;
pickle.load("output", myNewArray);
for (auto i : myNewArray)
cout << i << endl;
return 0;
}Pickle Module helps to store objects into a binary file and then we can use the stores data any time by just loading the binary file into program. We can also share our data that is stored on binary file with others by just sharing a binary file with them and they use the data by loading the binary file into program.