That would be due to those being the values for the light sensor... You want the file "/sys/bus/platform/devices/proximity/state" which can have a state of "open" or "closed". P.S. GIOChannels provide a nicer alternative to watching files.
int fd = open("/sys/bus/platform/devices/proximity/state", O_RDONLY, O_NONBLOCK, O_NOCTTY); GIOChannel *channel = g_io_channel_unix_new(fd); g_io_add_watch(channel, G_IO_IN | G_IO_PRI, (GIOFunc)readState, NULL); .......... gboolean readState(GIOChannel *channel, GIOCondition cond, gpointer data){ gchar *state; gsize size; GIOStatus ret = g_io_channel_read_line(channel, &state, &size, NULL, NULL); if (ret != G_IO_STATUS_ERROR){ printf("STATE: %s", state); if (strcmp(state, "open") == 0){ ........... } else if (strcmp(state, "closed") == 0){ ........... } g_free(state); }else return FALSE; return TRUE; }