in reply to the command - system ( "source ./profile") not working

source is a shell builtin, not a command.

.profile is usually a shell script which can be run with sh .profile, but I don't think it will do you any good (because .profile usually sets environment variables which are lost after system)