DragonFly On-Line Manual Pages

Search: Section:  


EZ_AddInput(3)                  EZWGL Functions                 EZ_AddInput(3)

NAME

EZ_AddInput, EZ_RemoveInput - register/remove input handlers

SYNOPSIS

#include <EZ.h> EZ_Input *EZ_AddInput(int fd, int mask, EZ_InputCallBack callback, void *data) void EZ_RemoveInput(EZ_Input *input)

ARGUMENTS

fd Specifies a file descriptor. mask Specifies the mask that indicates a read, write, or exception condition. It must be ORed from EZ_READABLE_MASK, EZ_WRITABLE_MASK and EZ_EXCEPTION_MASK. callback Specify the procedure to be invoked when input is ready. data Specifies the argument that is to be passed to callback when invoked. input Specifies a EZ_Input handler.

DESCRIPTION

EZ_AddInput registers an input handler to the EZWGL library. EZ_RemoveInput removes a previousely registered input handler. EZ_InputCallBack is a procedure of type void (*inputCallback)(void *object, void *data, int fd, int mask); Here is a simple input handler that reads from the standard input and insert the input in a text widget. static void readStdin(EZ_Input *id, void *data, int fd, int mask) { EZ_Widget *tw = (EZ_Widget *)data; char buf[1024]; int n; if(mask & EZ_READABLE_MASK) { n = read(fd, buf, 1023); if(n > 0) { buf[n] = 0; EZ_TextEndOfBuffer(tw); EZ_TextInsertString(tw,buf); } } }

SEE ALSO

EZ_EventMainLoop(3), EZ_ServiceEvents(3) EZWGL EZ_AddInput(3)

Search: Section: