- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
int enumDevices(DevInfo* &lst) {
int count = 0;
DevInfo* tmp = NULL;
Device device;
for (int i = 0; i < MAXDEVICES; i++)
if (device = OpenDevice(i)) {
count++;
realloc(tmp, sizeof(DevInfo)*count);
ReadInfo(device, &tmp[count-1]
}
if (count == 0) return 0;
lst = new DevInfo[count];
for (int i = 0; i < count; i++)
lst[i] = tmp[i];
free(tmp);
return count;
}
//................
DevInfo* list;
int devcount = enumDevices(list);
/* работаем со списком */
delete[] list;