Files
cdev-1.7.2n/test/cdevCollection/add4.cc
2022-12-13 12:44:04 +01:00

24 lines
864 B
C++
Executable File

#include <cdevCollection.h>
char * devices[] = {"device0", "device1", "device2", NULL};
void main ( void )
{
/**************************************************************
* Attach to the cdevCollection "brandNew" and add a NULL
* terminated list of devices to it.
**************************************************************/
cdevCollection & brandNew = cdevCollection::attachRef("brandNew");
brandNew.add(devices);
/**************************************************************
* Use the getList method to obtain the array of names that are
* currently stored in the cdevCollection and display them.
* Note that the list (not the list items) msut be deleted by
* the caller.
**************************************************************/
char ** list = brandNew.getList();
for(char **s = list; *s!=NULL; s++) printf("%s\n", *s);
delete list;
}