String, char problem. Location on the screen.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EARNEST
    New Member
    • Feb 2010
    • 128

    #1

    String, char problem. Location on the screen.

    Hello,

    I am using ubuntu and coding in C, also I am using ncurses.
    I have a string (array of chars).
    Let's say their position on the screen is:

    ABCD

    and

    (in this case i dont think a string is a good choice, but it must be considered as whole unit)
    ABC
    D

    How can i get their y,x coordinates in the stdscr?
    Thanks,
    EARNEST
  • EARNEST
    New Member
    • Feb 2010
    • 128

    #2
    any help pls? i got stuck on this one :(

    Comment

    • newb16
      Contributor
      • Jul 2008
      • 687

      #3
      So you already wrote some string to the screen and want to read the symbol at (x,y) position? If you didn't write them yet, you know the coordinates where you are going to output them - whateer in your algorithm determines it.

      Comment

      • EARNEST
        New Member
        • Feb 2010
        • 128

        #4
        hi,
        assume we have a program that randomly would put characters at random position. then i would want to see a char at (y,x). if there is nothing, then it is ' ', otherwise some other char. etc
        I have no idea how to do it, at first i thought mvgetch(y,x) would help, but not really.

        Comment

        Working...