.TH "KDK_PRINTER_GET_AVAILABLE_LIST" 3 "Fri Aug 25 2023" "Linux Programmer's Manual" \" .SH NAME kdk_printer_get_available_list - 获取本地的所有可用打印机(打印机处于idle状态) .SH SYNOPSIS .nf .B #include .sp .BI "extern char** kdk_printer_get_available_list();" .sp Link with \fI\-lkyprinter\fP. .SH "Detailed Description" The main function of the interface is to obtain all available printers locally (printers in idle state). .SH "RETURN VALUE" On success, returns a list of printer names of type char**, ending with a .BR NULL string; Generated by .I alloc and needs to be recycled by .BR kdk_printer_freeall .PP On error, return .BR NULL. .SH EXAMPLES .EX #include "libkyprinter.h" #include 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 , %d\n", 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 , %d\n", index + 1, available_printers[index], status); index++; } kdk_printer_freeall(available_printers); return 0; } .SH "CONFORMING TO" These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: .BR kdk_printer_get_list (), .BR kdk_printer_set_options (), .BR kdk_printer_print_download_remote_file (), .BR kdk_printer_print_local_file (), .BR kdk_printer_cancel_all_jobs (), .BR kdk_printer_get_status (), .BR kdk_printer_get_job_status (), .BR kdk_printer_get_filename () and .BR kdk_printer_freeall (). .SH "SEE ALSO" .BR kdk_printer_get_list (3), .BR kdk_printer_set_options (3), .BR kdk_printer_print_download_remote_file (3), .BR kdk_printer_print_local_file (3), .BR kdk_printer_cancel_all_jobs (3), .BR kdk_printer_get_status (3), .BR kdk_printer_get_job_status (3), .BR kdk_printer_get_filename (3) and .BR kdk_printer_freeall (3).