0

I'm coding a "kind of" editor in Linux using Ncurses. I created a window, initialized some Ncurses variables, loaded a file in memory (using another class) and then displayed that file on the window that I created. My problem is that I need to read what it is in the screen (a combination of user input and whatever was on the screen before)

So let's say that my document in the window looks like this:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

and then the user modifies the document like this:

 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 xxxxxxxxxxxxxxxxx  QAQAQAQAQAQAQAQAQAQAQAQAQAQAQAQAQA  xxxxxxxxxxxxxxxxxxxxxx
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

so the user typed Q's and A's but I'm interested to read the entire line, how can I do that?

I tried scanw() but didn't work. Thanks in advance for any help or hint that you can give me.

icedwater
  • 4,701
  • 3
  • 35
  • 50
juanp_1982
  • 917
  • 2
  • 16
  • 37
  • possible duplicate of [Check char at current/given position in PDCurses/NCurses](http://stackoverflow.com/questions/8066592/check-char-at-current-given-position-in-pdcurses-ncurses) – Craig Jun 28 '13 at 15:53

1 Answers1

1

Curses keeps an internal map of the window, you can interrogate it with:

 chtype inch(void);
 chtype winch(WINDOW *win);
 chtype mvinch(int y, int x);
 chtype mvwinch(WINDOW *win, int y, int x);

You'll have to read each position in the window.

The chtype contains the character and flags for effects like bold etc

parkydr
  • 7,596
  • 3
  • 32
  • 42