pointer motion. why are numbers so high? why does it print info in blocks not a constant stream?

前端 未结 1 782
清酒与你
清酒与你 2021-01-24 01:07

Hi! I am trying to write a program where I need to report the position of every mouse motion. I have called the XSelectInput() function with a PointerMotionMa

1条回答
  •  被撕碎了的回忆
    2021-01-24 01:45

    Besides printing a newline at the end, you could also do a '\r' at the end it it will move the cursor to the beginning of the existing line, so it will just print over itself each time. To make this work better, change the digit formatting to be a fixed size, like:

    printf("%4d, %4d  \r", event.xmotion.x, event.xmotion.y);
    fflush(stdout) ;
    

    0 讨论(0)
提交回复
热议问题