How do i use parameters in a system call?
For example: ipconfig /all

Recommended Answers

All 6 Replies

you have to create one string that contains all the parameters. For example system("ipconfig /all ");

Thank you works real nice.
But I have another problem, how do a change directory?
I have tried "cd .." but it wont work.

Member Avatar for iamthwee

Could be a problem with either surrounding your path with quotes or not putting double backslashes to separate the directories I think.

What's your path?

Thank you works real nice.
But I have another problem, how do a change directory?
I have tried "cd .." but it wont work.

Well, you coul just call chdir() function.

Member Avatar for iamthwee

Yeah that's better I don't think my way works. I suppose a way to get around it would be to write the command as a .bat file then call the .bat file from system.

The system() call forks out to another process. So if you use it to change the directory, it affects the new process, not your program.

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.