Impulse 463E User Manual

Page 97

Advertising
background image

© Sealevel Systems, Inc.

- 94 -

SeaI/O User Manual

Finding All Devices

This simple code segment issues a find on all devices and then prints out each device
using the print_info function code segment from the previous page.

This code segment allocates space for ten devices and then performs a find for
devices. If the return code is greater than zero, then the function successfully found
the number of devices returned.
Notice that we have to explicitly Free() the allocated buffers, and then delete the class
for proper memory management.

int main(int argc, char* argv[])
{
CCEthernet

*a;

ceth_device_p

b;

ceth_device_p

d;

int

c;

int

i;


a = new CCEthernet();

b = a->Alloc(10);

c=a->find_devices(Sealevel_All_Devices,10,b);
if(c<0)
{
printf("Error

%d\n",c);

goto

end;

}
printf("Found

%d\n",c);

d=b;
for(i=0;i<c;i++)
{
dump_out(d);
d++;
}
end:
a->Free(b);
delete(a);
return

0;


}


Advertising