Find the answer to your Linux question:
Results 1 to 2 of 2
Hi Is it posssible to get Printer status (Tray is empty) in CEnt oS 5.1 using the CUPS API through C program. I have written one c program but it ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    Smile Printer Status

    Hi
    Is it posssible to get Printer status (Tray is empty) in CEnt oS 5.1 using the CUPS API through C program.

    I have written one c program but it is retuning none value only..

    code :
    #include <cups/cups.h>
    int main()
    {
    cups_dest_t *dests;
    int i=0,j=0;
    const char *value;
    int num_dests = cupsGetDests(&dests);
    printf ( " The number of Printers available is %d\n", num_dests);
    for (j =0;j<num_dests;j++,dests++)
    {
    cups_dest_t *dest = cupsGetDest(dests->name,
    dests->instance,
    dests->num_options,
    dests);
    printf("Printer name is %s\n",dest->name);
    for (i = 0; i < dest->num_options; i++)
    {
    if(NULL!= dest->options)
    {
    printf("The option name is : %s\n",dest->options[i].name);
    printf("The value is : %s\n",dest->options[i].value);
    }
    }
    printf("****************************************** ***\n");
    }
    cupsFreeDests((num_dests), dests);
    return 0;
    }


    outPut :

    The number of Printers available is 1
    Printer name is printer
    The option name is : printer-info
    The value is : printer
    The option name is : printer-is-accepting-jobs
    The value is : 1
    The option name is : printer-is-shared
    The value is : 1
    The option name is : printer-make-and-model
    The value is : HP LaserJet 4000 Series Postscript (recommended)
    The option name is : printer-state
    The value is : 3
    The option name is : printer-state-change-time
    The value is : 1239031230

    *********************************************
    The option name is : printer-state-reasons
    The value is : none
    **********************************************



    Can any body help to retrive the printer state reasons ..

    thanks in advance
    rakesh

  2. #2
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    Thumbs up Printer status

    Can any body help me to get printer status through C program in Linux.

    I need the paper status in printer .....
    Is it possible....
    Thanks in Advance..
    Rash...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...