kdk_printer_get_list3
获取本地的所有打印机(包含可用打印机和不可用打印机)
Usage
#include <libkyprinter.h> extern char** kdk_printer_get_list(); Link with -lkyprinter.
Detailed Description
The main function of the interface is to obtain all printers locally (both available and unavailable).
Return value
On success, returns a list of printer names of type char**, ending with a NULL string; Generated by alloc and needs to be recycled by kdk_printer_freeall
On error, return NULL.
Examples
#include "libkyprinter.h"
#include <stdio.h>
int main()
{
int index = 0;
//获取全部打印机列表
char **printers = kdk_printer_get_list();
while (printers[index])
{
int status = kdk_printer_get_status(printers[index]);
printf("%zd: %s , %d0, index + 1, printers[index], status);
index++;
}
kdk_printer_freeall(printers);
//获取可用打印机列表
index = 0;
char **available_printers = kdk_printer_get_available_list();
while (available_printers[index])
{
int status = kdk_printer_get_status(available_printers[index]);
printf("%zd: %s , %d0, index + 1, available_printers[index], status);
index++;
}
kdk_printer_freeall(available_printers);
return 0;
}