#include <unistd.h> /* open() */ #include <fcntl.h> /* O_RDWR */ int fd; if ((fd = open("/dev/mem", O_RDWR)) < 0) { /* handle error here */ }