THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/09/2004 at 07:24, xxxxxxxx wrote:
I think you can make those library functions quite short if you use this trick... 
const LONG UNIQUE_ID = 42;
const DUMMY_OBJECT_TYPE = Osphere;
Filename fn;
fn.FileSelect(FSTYPE_ANYTHING, GE_SAVE);
{
BaseContainer bc;
bc.SetString(1000, "Test");
AutoAlloc<BaseDocument> doc; if (!doc) return FALSE;
AutoAlloc<BaseObject> obj(DUMMY_OBJECT_TYPE); if (!obj) return FALSE;
obj->SetData(bc);
doc->InsertObject(obj, NULL, NULL);
WriteHyperFile(doc, obj, fn, UNIQUE_ID);
obj->Remove();
}
{
AutoAlloc<BaseDocument> doc; if (!doc) return FALSE;
AutoAlloc<BaseObject> obj(DUMMY_OBJECT_TYPE); if (!obj) return FALSE;
doc->InsertObject(obj, NULL, NULL);
ReadHyperFile(doc, obj, fn, UNIQUE_ID, NULL);
obj->Remove();
GePrint(obj->GetData().GetString(1000));
}