QProcess doesn't emulate a complete shell. For changing the working dir, use QProcess::setWorkingDirectory() and then call clear.
However, I don't see how this could make sense. clear clears the screen of the current terminal, since you don't have one, there's nothing to be cleared.
AFAIK there is no such program as "cd" -- it is implemented by shells (try calling "which cd" and you'll see that you don't have such tool in your path) and thus you can't call it via QProcess (well... you can, but it wouldn't have any effect on anything as the shell would end immediately). To change directories use QDir or QApplication methods.
Having the ability to read and understand seems to be luxury.
In my first post I told you that you can use
void QProcess::setWorkingDirectory ( const QDir & dir ) [virtual]
Sets dir as the working directory for processes. This does not affect running processes; only processes that are started afterwards are affected.
Setting the working directory is especially useful for processes that try to access files with relative paths.
See also workingDirectory() and start().
if you want to execute your command in a certain directory. Running "cd <whatever>" in a QProcess is just useless as it *isn't* a complete shell.
I get a memory referencing error.
And regarding using the cd command. If I use this command and change the path to Version/Temp then does it mean that now all my processes will get input and generate output from the changed path?
Thank you and sorry for replying and not generating a new thread- just tht that this was a related issue ...
Originally posted by GuestInTrouble
And regarding using the cd command. If I use this command and change the path to Version/Temp then does it mean that now all my processes will get input and generate output from the changed path?
If the process run by QProcess changes its path, only this process has a different path, not the parent or any other of its child processes.