bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printing the screen


From: Peter Jay Salzman
Subject: Re: printing the screen
Date: Thu, 23 Aug 2001 15:13:57 -0700
User-agent: Mutt/1.3.20i

hi thomas and all,

ok, i changed

        fputc(A_CHARTEXT & mvinch(row,col), pipe);

to

        fputc(0xff & mvinch(row,col), pipe);

just to make absolutely sure i don't have a problem with the width of
A_CHARTEXT.   it's still printing a single blank page.

any more ideas?

do you have any source code which does a similar thing that i can look at and
compare to?

pete

begin: Thomas Dickey <address@hidden> quote
> On Wed, Aug 22, 2001 at 10:39:47AM -0700, Peter Jay Salzman wrote:
> > 
> > i'm trying to implement a print function for one of my ncurses programs.
> > what i'd like is to simply print the entire screen.
> > 
> > i made two attempts, both listed below.  they both print garbage.
> 
> just reading the code, it looks like it would work - the only thing
> I see that might go wrong is if your A_CHARTEXT is setup for the
> wide-char config (so that would be 0xffff, not good for a mask to fputc).
>  
> > void print_screen(char (*win3)[INPUT_SZ]) {
> >    FILE *pipe;
> >    int row, col, cur_x, cur_y, cur_state, err=0;
> > 
> >    getsyx(cur_y, cur_x);
> >    cur_state = curs_set(0);
> >    fflush(stdout);
> >    pipe = popen("lpr", "w");
> >    if (pipe == NULL) {
> >       err=1;
> >    } else {
> >       for (row=0; row < LINES; ++row) {
> >          for (col=0; col < COLS; ++col) {
> >             fputc(A_CHARTEXT & mvinch(row,col), pipe);
> >          }
> >          fputc('\n', pipe);
> >       }
> >       if(pclose(pipe)==-1) err=2;
> >       setsyx(cur_y, cur_x);
> >       curs_set(cur_state);
> >       refresh();
> >    }
> >    switch(err) {
> >       case 0:  pushWin3(win3, "Screen printed?");      break;
> >       case 1:  pushWin3(win3, "popen() failed.");      break;
> >       case 2:  pushWin3(win3, "pclose() failed.");     break;
> >       default: pushWin3(win3, "I shouldn't be here!"); break;
> >    }
> > }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]