packdata.cpp added, the converse of getdata.cpp