As far as I know, using system() on the program is like typing on the terminal, and if I put on the terminal cd Desktop it sets the directory to the desktop as it should.
So I am trying to set a directory like system(cd ~/Desktop); or system(cd Desktop);, so then execute a file typing ./theFileName, but it isn't working. And if after that I put system(ls); it shows the files of the directory that this program itself is.
PD: I am on mac