[sane-devel] Number of devices

Ralph Little skelband at gmail.com
Thu Jan 28 15:41:14 GMT 2021


Hi,

On 2021-01-28 6:40 a.m., Thiago Milczarek SayĆ£o wrote:
> Warning: Might be a stupid question.
>
> const SANE_Device **dev_list;
> sane_get_devices(&dev_list, SANE_FALSE);
>
> How do I get the size of dev_list?
>
> Thanks.

There is no length parameter.
If you just wish to count the devices, loop through it until you get to
a NULL pointer.

You can find an example in the SANE backends source for scanimage:
frontend/scanimage.c around line 2184.

Have you read the SANE API spec?
If not, it is here:

https://sane-project.gitlab.io/standard/

Cheers,
Ralph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20210128/29230ea3/attachment.html>


More information about the sane-devel mailing list