Florian Pasquereau
Florian Pasquereau

Reputation: 132

Get informations from mouse

I'm doing my own FTP in C with ncurses. I know it's possible to get information like coord of click ... with the function getch(). My problem is for this school subject I can't use this function.

I would like to know if it's possible to get information like coord click, position, with button is used ... from the mouse in a terminal with read?

If it's possible with file descriptor I have to read?

Else with call system can do it?

I'm on sierra :)

Update

Yes I have a piece of code to get values

for example :

mouse click left down : 27, 91, 77, 32, 57, 67, 0, 0, 0
mouse click left up   : 27, 91, 77, 35, 57, 67, 0, 0, 0

Like you can see I get 6 bytes for all events.
I understand byte[0] until byte[3] but I don't know what the byte 4 and 5 mean ... They look like random :(

Values are print in decimal

Upvotes: 0

Views: 64

Answers (1)

user2371524
user2371524

Reputation:

My problem is for this school subject i can't use this function.

Then you're out of luck. curses provides this for a reason: it abstracts the many platform-dependent ways how to get mouse input. If you can't use what curses provides, you have to write code specifically for your target platform, which doesn't make any sense if you already use curses.

Upvotes: 2

Related Questions