Convert realdos.c to C++