Impulse 463E Uživatelský manuál Strana 97

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 109
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 96
© 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;
}
Zobrazit stránku 96
1 2 ... 92 93 94 95 96 97 98 99 100 101 102 ... 108 109

Komentáře k této Příručce

Žádné komentáře