C++ version of Dynamic-MOTD