cups:如何确定当前/默认打印机是否已物理连接并打开
cups: How can I determine if the current / default printer is physically connected and turned on?
有没有办法使用 libcups 或 Qt 检测打印机是否在线?
我正在开发一个需要打印机的程序,并且同时使用libcups和QPrinter
如果当前/默认打印机未连接,我想给用户一个很好的错误消息。
现在,如果默认打印机已关闭(或未连接(,
cups_dest_s printers = NULL;
int printerCount = cupsGetDests(&printers);
这将崩溃:
*** glibc detected *** /home/me/myApp/myApp: double free or corruption (out): 0x088501e0 ***
如何确定当前/默认打印机是否已物理连接并打开?
没有准确的方法来检测打印机的状态,因为某些打印机无法向操作系统报告其状态。
您可以通过以下方式获取打印机的当前状态:
PrinterState QPrinter::printerState() const
它返回 Idle
、Active
、Aborted
和 Error
。您可以检查打印机状态是Active
还是Idle
。但是不能保证您的打印机正确报告其状态。
相关文章:
- 是否有 Windows 用户空间函数来枚举连接的网络共享?
- 某些 boost::asio 异步函数是否将处理程序连接到操作,以便处理程序被触发一次?
- 如何在 c++ 中确定 tcp 客户端是否连接
- SDLnet检查TCPsocket是否已关闭连接
- 如果代码中没有连接任何插槽,是否有理由发出Qt信号?
- TCP/IP 客户端是否可以连接到无法访问的 IP
- 将 QObject 用作类成员并将该成员用作连接的上下文是否安全?
- 如何检查LLDB是否可以连接到二进制
- 如何在C API中检查MySql连接是否处于活动状态
- C++ODBC检查连接是否成功
- 在读取期间,非重叠串行端口连接是否会阻止写入(反之亦然)
- 如何在C++中检测我的局域网连接是否断开
- 检查连接是否在libpqxx(postgres)中处于活动状态
- 如何确定阻塞的 SSL BIO 连接是否已关闭
- 在哪里建立连接是否重要
- 如何知道TCP连接是否存在于同一机器上的两个进程之间
- 如何检查连接是否丢失
- 如何确定与套接字的连接是否已关闭
- 头可连接连接是否可以具有争用条件?你如何绕过它
- 数据库连接是否可以重用