system (\"cd ..\");
This doesn\'t produce any error but also doesn\'t do anything meaningful. Why?
system runs the command you passed it in a different process (in a subshell). That subshell changes directories and promptly exits.
system
That's all perfectly valid, but perfectly useless. Use chdir to change your working directory.
chdir