jobs array
pieterjandeboeck at yahoo.co.uk
pieterjandeboeck at yahoo.co.uk
Mon Aug 2 07:45:51 PDT 2004
Thanks :)
its been a while since i actually handled a raw array. (since school days. I have been using NSArray and NSMutable array which do everything for you. I actually felt very ashamed asking such a newbie question :)
I understand the flags you were explaining. (i used my own created constants set to bool values to simplify the meanings of each value. (makes logical errors less likely during editing :)
it was the "memmove" stuff i didn't know how to do :)
Also I noticed you are counting down. I read somewhere it improves speed although i never do it myself. Is it much better?
PJ
PS: and thanks again :)
Michael Sweet wrote:
> pieterjandeboeck at yahoo.co.uk wrote:
> > ...
> > ONLY_PROCESSING_JOBS (value 0) indicates it only returns jobs
> > currently being processed. Although it also returns jobs in
> > IPP_JOB_HELD state.
>
> Actually, that boolean maps to the IPP "which-jobs" attribute
> which supports the values "completed" and "not-completed".
> Passing 1 returns completed jobs and 0 returns not-completed
> jobs.
>
> > ...
> > for (int i=0; i < currentNewJobCount; i++) { if ( jobs[i] ==
> > IPP_JOB_HELD )
> >
> > how do i remove a job from this array?
>
> What I would do is something like:
>
> int i;
> int num_jobs;
> cups_job_t *jobs;
>
> num_jobs = cupsGetJobs(&jobs, NULL, 0, 0);
>
> for (i = num_jobs - 1; i >= 0; i --)
> if (jobs[i].state == IPP_JOB_HELD)
> {
> if (i < (num_jobs - 1))
> memmove(jobs + i, jobs + i + 1,
> (num_jobs - 1 - i) * sizeof(cups_job_t));
>
> num_jobs --;
> }
>
> The alternative is just to not display jobs with the held state
> (or visa-versa).
>
> --
> ______________________________________________________________________
> Michael Sweet, Easy Software Products mike at easysw dot com
> Printing Software for UNIX http://www.easysw.com
More information about the cups-devel
mailing list