This is a child process used to receive messages and send it back to its father.
This is a child process used to receive messages and send it back to its father.Check the Full tutorial
#include <stdio.h>
#include <unistd.h>
#include <Ecore.h>
#define BUFFER_SIZE 1024
#ifdef _WIN32
#define HANDLER_TYPE Ecore_Win32_Handler
#else
#define HANDLER_TYPE Ecore_Fd_Handler
#endif
{
static int numberOfMessages = 0;
char message[BUFFER_SIZE];
if (!fgets(message, BUFFER_SIZE, stdin))
numberOfMessages++;
if (numberOfMessages < 3)
{
printf("My father sent this message to me:%s\n", message);
fflush(stdout);
}
else
{
printf("quit\n");
fflush(stdout);
}
}
int
main(void)
{
goto error;
#ifdef _WIN32
_fd_handler_cb,
NULL);
#else
_fd_handler_cb,
NULL, NULL, NULL);
#endif
return EXIT_SUCCESS;
error:
return EXIT_FAILURE;
}
Ecore_Win32_Handler * ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data)
Creates a Ecore_Win32_Handler object and add it to the win32_handlers list.
Definition: ecore_main.c:1587
Ecore_Fd_Handler * ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data)
Adds a callback for activity on the given file descriptor.
Definition: ecore_main.c:1449
@ ECORE_FD_READ
Fd Read mask.
Definition: Ecore_Common.h:1388
EAPI int ecore_shutdown(void)
Shuts down connections, signal handlers sockets etc.
Definition: ecore.c:371
EAPI int ecore_init(void)
Sets up connections, signal handlers, sockets etc.
Definition: ecore.c:230
#define ECORE_CALLBACK_RENEW
Return value to keep a callback.
Definition: Ecore_Common.h:153
#define ECORE_CALLBACK_DONE
Return value to stop event handling.
Definition: Ecore_Common.h:156
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1321
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1311
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339