Ημερήσια αρχεία: 10 Ιανουαρίου 2012


C/C++: An interresting macro to capture errors with perror, use custom error code number

#include <stdio.h>
#include <errno.h>
#define handle_error_ern(ern, msg) do { errno = ern; perror(msg); exit(EXIT_FAILURE); } while (0

Usage Example: handle_error_ern(s, “pthread_getaffinity_np”);