I am a fan of C file streams over C++, so that would be my way to go. But I am not the OP so perhaps....
Example:
Code:fstream *printer(mode_t perm) { #ifdef ELYSIA fstream *f = NULL; #else fstream *f = 0; #endif int fd = open("/dev/parport0", O_RDWR, perm); // do whatever you need to do.... try { f = new fstream(fd); } catch(std::exception e) { close(fd); abort(); } return f; }