gpt4 book ai didi

c - 我想用 c 语言使用 libimobiledevice 但我不明白

转载 作者:行者123 更新时间:2023-11-30 15:27:28 26 4
gpt4 key购买 nike

idevice_error_t idevice_get_device_list (char ***devices, int *count) 的含义是什么

我如何在idevice_get_device_list中传递参数

char ***devices 的含义是什么?我如何创建变量并将其传递给 ***devices

请给我一个例子来说明如何使用此功能...

void    idevice_set_debug_level (int level)
Sets the level of debugging.
idevice_error_t idevice_event_subscribe (idevice_event_cb_t callback, void *user_data)
Register a callback function that will be called when device add/remove events occur.
idevice_error_t idevice_event_unsubscribe ()
Release the event callback function that has been registered with idevice_event_subscribe().
idevice_error_t idevice_get_device_list (char ***devices, int *count)
Get a list of currently available devices.
idevice_error_t idevice_device_list_free (char **devices)
Free a list of device uuids.
idevice_error_t idevice_new (idevice_t *device, const char *uuid)
Creates an idevice_t structure for the device specified by uuid, if the device is available.
idevice_error_t idevice_free (idevice_t device)
Cleans up an idevice structure, then frees the structure itself.
idevice_error_t idevice_connect (idevice_t device, uint16_t port, idevice_connection_t *connection)
Set up a connection to the given device.
idevice_error_t idevice_disconnect (idevice_connection_t connection)
Disconnect from the device and clean up the connection structure.
idevice_error_t idevice_connection_send (idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
Send data to a device via the given connection.
idevice_error_t idevice_connection_receive_timeout (idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
Receive data from a device via the given connection.
idevice_error_t idevice_connection_receive (idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
Receive data from a device via the given connection.
idevice_error_t idevice_get_handle (idevice_t device, uint32_t *handle)
Gets the handle of the device.
idevice_error_t idevice_get_uuid (idevice_t device, char **uuid)
Gets the unique id for the device.

最佳答案

看来idevice_get_device_list接受一个指向 char** 类型变量的指针并将其设置为指向 char* 类型的值数组,也就是说,字符串。它还需要一个指向int类型变量的指针。并将其设置为该数组中的字符串数。

char **device_list;
int count;

idevice_error_t status = idevice_get_device_list(&device_list, &count);

/* check status for error conditions here */

for (int i = 0; i < count; ++i) {
printf("Device %d: %s\n", i, device_list[i]);
}

关于c - 我想用 c 语言使用 libimobiledevice 但我不明白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26961152/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com