int main(int argc, char **argv) { GOC_IStream* is = NULL; GOC_Iterator* it = NULL; GOC_Properties* props = NULL; if ( argc != 2 ) { GOC_INFO("Podaj jako argument plik typu properties"); return -1; } is = goc_fileIStreamOpen(argv[1]); props = goc_propertiesAlloc(); props = goc_propertiesLoad(props, is); it = goc_propertiesListCategories(props); while ( goc_iteratorHasNext(it) ) { GOC_Category* cat = (GOC_Category*)goc_iteratorNext(it); printf("GOC_Category: %s\n", cat->name); GOC_Iterator* pit = goc_propertiesListCategory(props, cat->name); while ( goc_iteratorHasNext(pit) ) { GOC_Property* p = (GOC_Property*)goc_iteratorNext(pit); printf("\t%s = %s\n", p->name, p->value); } free(pit); printf("\n"); } free(it); props = goc_propertiesFree(props); goc_isClose(is); return 0; }
int main() { GOC_Iterator *iterator = NULL; int *pTable = NULL; _GOC_TABEL_SIZETYPE_ nTable = 0; pTable = goc_tableAdd(pTable, &nTable, sizeof(int)); pTable[nTable-1] = 1; pTable = goc_tableAdd(pTable, &nTable, sizeof(int)); pTable[nTable-1] = 15; pTable = goc_tableAdd(pTable, &nTable, sizeof(int)); pTable[nTable-1] = 21; pTable = goc_tableAdd(pTable, &nTable, sizeof(int)); pTable[nTable-1] = 148; pTable = goc_tableAdd(pTable, &nTable, sizeof(int)); pTable[nTable-1] = 419; pTable = goc_tableAdd(pTable, &nTable, sizeof(int)); pTable[nTable-1] = 1439; iterator = goc_tableIteratorAlloc( (void*)pTable, nTable ); while ( goc_iteratorHasNext( iterator ) ) { int e = (int)goc_iteratorNext( iterator ); printf("%d\n", e); } goc_tableIteratorFree( iterator ); return 0; }