Hiiee der..guyss i wud be gratefull if some1 can help me to sort this bit of my programme.
In the shell that i am writing I need to use cd command...(move around the path specified ..das wat i think it does in linux)
I have no idea how to get this working.I have done the "ls" command and it works perfectly.
Now I am struck here and I am in need of some urgent help.
If any1 of you have any idea please help mee.
sfe.

Recommended Answers

All 3 Replies

do you mean something like system("cd .."); ?

yeh..like cd ..
you know for the change directory.

what do you want to know about it? The problem with using system() to change directories is that the directory is changed only while the system() function is doing its thing. As soon as system() returns to your program the directory is changed back to what it was originally.

There is a way around the problem and that is not to use system() but use standard C function chdir() or _chdir() depending on your compiler.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.