hi guys i want to make a c program,what it has to do is to find its current pathname every time it is executed from diferent locations and then redirect the outcome in a .txt file,through cmd.I have lack of knowledge when it comes to cmd so any help?

Try the system function call...
It takes strings (your command) as arguments to it and runs that command at the console.
So for your purpose, you can try this...

system("pwd >>file.txt");

So, pwd command will get the current working directory and >> will redirect the output and append it to the text file named file.txt.
Cheers,

well about the system command..i know that this will work in unix enviroment the problem is i want to make it work in windows..

Dear libathos,
system function call is work with Windows also...so it will not be a problem.
If you are having a static string as command like "pwd" you can directly have it in system() call. If, otherwise you want to include any variable then you can use sprintf before it.
Example:

sprintf(command, "nbtstat -A %d.%d.%d.%d" ,a,b,c,d);
system(command);

Otherwise, I think it should work fine...

no you didnt understand correctly...i know how to use the system command..i dont know the equal for pwd...

This question has already been answered. Start a new discussion instead.