replaced the shell script with a c++ file