[comp.lang.c] help with curses

jsv9504@ultb.isc.rit.edu (J.S. Veiss) (01/15/90)

I'm trying to print graphics characters in a program using the curses library.
I've gotten things down to be the only way the print the escape codes to change
the character set is to print it to stdout instead of stdscr.  However, when I
print with stdout, I don't know where it's going to go on the screen.  It's
really wierd, so bear with me here.

I'm passing a row and a column into a function.  I'm printing out numbers with
printw above each of the objects I'm printing with printf, followed by a
refresh.  Basically, it looks kinda like this:

PrintCard (row, col)

int row, col;

{
   move (row, col + 3);
   printw ("%d", col / 10);
   move (++row, col);
   printf ("%slqqqqqk%s", GRPH, ASCII);
   refresh ();
}

'col' comes in as multiples of 10.  GRPH is the escape code for the graphics
set.  ASCII is the escape code to switch back to the ascii character set.

what gets printed (in the correct row) is:

             1                 2           4     3   5
          +-----+           +-----+     +-----+-----+      <-graphics chars.

what should be printed is:
            1         2         3         4         5
         +-----+   +-----+   +-----+   +-----+   +-----+

I have to use printf because printw literally prints the escape codes as text
(i.e. the terminal doesn't get the escape command).  There is a constant for
use with attrset (), A_ALTCHARSET, but it doens't seem to do anything.  It
seems as if the 'col' variable I'm passing into move is getting screwed up,
because if I print out the column number before I print each of the above
entities out, the numbers print fine (in the right places.)

I've been working on this for many hours.  Think you can help?

I'd appreciate any help...

Jepher

------------------------------------------------------------------------------
Send replies/flames to:
JSV9504@RITVAXC.bitnet             Snail Mail: Jepher Veiss
JSV9504@ULTB.ISC.RIT.edu                       315 Fairwood circle
                                               Rochester, NY 14623

ryan@sjuphil.uucp (Patrick M. Ryan) (01/17/90)

In article <1928@ultb.isc.rit.edu> jsv9504@ultb.isc.rit.edu (J.S. Veiss) writes:
>
>I'm trying to print graphics characters in a program using the curses library.
>I've gotten things down to be the only way the print the escape codes to change
>the character set is to print it to stdout instead of stdscr. 

     curses does some sort of filtering when it prints characters to the
screen.  to print graphics characters to the screen, you need to use the
raw I/O functions.  there is a function 'addrawch' which i use to print
characters like arrows.

-- 
patrick m. ryan
  ryan%sjuphil.sju.edu@bpa.bell-atl.com
  {bpa|burdvax|princeton|rutgers}!sjuphil!ryan
  pmr@gemini.gsfc.nasa.gov