|
/* Gamelon(tm) File I/O Library Sample Code C++ Language */ /* (C)1994 Menai Corporation(tm) Released for public use */
/* Example 7. How to conduct a Fixed Transaction */ /* alteration. */
/* Fixed Transactions occur in reference to a */ /* particular position within the file. The contents */ /* of the transaction are Inserted before the */ /* current location of the cursor, Appended after */ /* the current location of the cursor, or replace */ /* the object in the current focus of the cursor. */ /* The following example shows the steps necessary */ /* to perform a Fixed Transaction: */
/* Beginning file layout: */ /* { } */ /* [2]{ }[3.14159] */ /* [5700304] */
#include <stdlib.h> #include "gfcursor.hpp"
int main(void) { char newchar = 'u'; int valid; CURSOR *c = new CURSOR("newfile"); c>eCursorQueryValid(&valid); if (!valid) exit(1); c>eCursorMoveIn(); c>eCursorMoveLast(); c>eAltInsert(); c>eAltBeginFixedTransaction(); /* Cursor moves to temporary file. */ c>eCursorMovePreFirst(); c>eAltAppend(); c>eObjWrite(newchar); c>eAltAppend(); c>eObjWriteAggregate(); c>eCursorMoveNext(); c>eAltModify(); c>eAltStartAggregating(); c>eObjSetComment("A single character."); c>eObjSetClass(144); c>eObjWrite(newchar); c>eObjApplyIdentity(); c>eObjSetComment("budget"); c>eObjImportOSFile("123sheet.w1", OSF_ALL); /* Commit ends aggregation, not Fixed Transaction. */ c>eAltCommit(); c>eAltCommitFixedTransaction(); delete c; return 0; }
#if 0 /* Ending file layout (in vertical display format): */ /* { */ /* [2] */ /* { */ /* [5700304] */ /* } */ /* { */ /* ['u':CL(144):CO("A single character.")] */ /* ["123sheet.w1":ID(/*9*/):CO("Budget")] */ /* } */ /* ['u'] */ /* [3.14159] */ /* } */ #endif |
||||||||||||||
| |
||||||||||||||
|
Home | Product | Consulting | Programming | Reviews | Company | Site Map | Guest Book |
||||||||||||||
|
Menai Corporation, 1010 El Camino Real, Suite 300, Menlo Park, California 94025-4335 |
||||||||||||||
|
Copyright © 1996-98 Menai Corporation. All Rights Reserved. Menai, Gamelon and gamelon(stylized) are worldwide trademarks of Menai Corporation, registered in the United States of America, and the .[g] logo is a worldwide trademark of Menai Corporation. All other trademarks are owned by their respective owners. |
||||||||||||||