/* Gamelon(tm) File I/O Library Sample Code  C Language   */

/* (C)1994 Menai Corporation(tm)  Released for public use */

 

/* Example 10a. How to use a Cursor to scan objects in */

/* the top level of an aggregate.                      */

 

/* Simple Next and Prior commands can scan across all  */

/* the objects on a single level within an aggregate   */

/* object. If the cursor starts on the first object    */

/* within an aggregate, the Cursor can use a loop with */

/* a Next call to scan each and every object in the    */

/* aggregate. For example, if the programmer wished to */

/* set a particular class number for every object in   */

/* an aggregate, he or she would use the following     */

/* code:                                               */

 

#include <stdlib.h>

#include "gfcursor.h"

 

int main(void) {

    unsigned long classnum = 4000000;

    int answer;

    int valid;

 

    CURSOR *c = new_CURSOR(NULL,

      "newfile",

      AM_SHARED,

      NULL,

      0);

    eCursorQueryValid(c, &valid);

    if (!valid)

      exit(1);

    /* Check that the file has contents. */

    eObjQueryAggregateEmpty(c, &answer);

    if (answer)

      exit(1);

    eCursorMoveIn(c);

    eCursorMovePreFirst(c);

    while (eCursorMoveNext(c, OT_OBJ) == 0) {

      eAltModify(c);

      eObjSetClass(c, classnum);

      eAltCommit(c);

    } /* end while */

    delete_CURSOR (c);

    return 0;

}

Return to Samples List

Download this sample source code

 Home | Product | Consulting | Programming | Reviews | Company | Site Map | Guest Book

 Menai Corporation, 1010 El Camino Real, Suite 300, Menlo Park, California 94025-4335
 800-GAMELON (800-426-3566) (US only), 650-853-6450 (voice), 650-853-6453 (fax)
 Questions about our products and services:
info@menai.com.
 Comments about this web site:
webmaster@menai.com.

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.