id a = [[NSClassFromString(@"MyExampleClass") alloc] init];
используйте это, это даст вам то, что вы хотите.
Я давно не играл с C, но вы можете использовать функцию fcntl () для изменения флагов файлового дескриптора:
#include <unistd.h>
#include <fcntl.h>
// Save the existing flags
saved_flags = fcntl(fd, F_GETFL);
// Set the new flags with O_NONBLOCK masked out
fcntl(fd, F_SETFL, saved_flags & ~O_NONBLOCK);
Я ожидал, что простое отключение флага O_NONBLOCK
должно вернуть файловый дескриптор в режим по умолчанию, который является блокирующим:
/* Makes the given file descriptor non-blocking.
* Returns 1 on success, 0 on failure.
*/
int make_blocking(int fd)
{
int flags;
flags = fcntl(fd, F_GETFL, 0);
if(flags == -1) /* Failed? */
return 0;
/* Clear the blocking flag. */
flags &= ~O_NONBLOCK;
return fcntl(fd, F_SETFL, flags) != -1;
}