Added code to find executable path/home directory on Windows.
Added forgotten #include <cstdio> for a sprintf.
s/sleep/Sleep/ macro for Windows.