Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

inch() pdcurses 2.8

Help
Kurgusov
2007-03-15
2013-04-25
  • Kurgusov
    Kurgusov
    2007-03-15

    Hi everyone,
    I'm about to start a project hopefully using pdcurses 2.8 .I'll have to use the inch() funcs ALOT,but since it does'nt work if the characters on the screen are in colour I was wondering is there a way around this apart from not using colour(as in attron(COLOR_PAIR(COLOR1)).
    Any help so-much apprieciated.

     
    • inch() works fine when the characters are in color. I can only assume that you're misinterpreting the return values. inch() returns a chtype, not a char -- a chtype is the character PLUS the attribute. If you want just the character portion, then take the result, and & it with A_CHARTEXT.

       
    • P.S. Or use instr() instead.

       
    • Kurgusov
      Kurgusov
      2007-03-15

      Thx for the reply but I'm not sure I understand.
      To test my function
      I fill the screen with '#' and then go...

      if(mvinch(3,3)=='#'){printw("do this");}

      ......if i have attron(COLOR_PAIR(COLOR1));
      before i fill the screen then "do this" never appears even though the screen is full of '#',
      if i dont set the colour then it will print "do this"?

       
    • if ((mvinch(3, 3) & A_CHARTEXT) == '#') {printw("do this");}

       
    • P.P.S. I see that the description of this function in PDCurses' documentation is terrible. I'll fix that... meanwhile, you might want to consult the X/Open or ncurses docs.

       
    • Kurgusov
      Kurgusov
      2007-03-16

      Excellent,thank you very very much.
      respects Hugh.