Does anyone know where I can find a manual page for the system(); function? I can't find one. Usually it is just a "man fgets()" google away, only in this case system. But I can't find anything on it.
Printable View
Does anyone know where I can find a manual page for the system(); function? I can't find one. Usually it is just a "man fgets()" google away, only in this case system. But I can't find anything on it.
Well, thats weird because the 2nd link I actually went to that site and searched, I guess I just over looked it. Well, I still can't figure out the return value. Because eveytime I try to compile I get an error. Could someone paste a simple piece of code or help me out. I just need to figure out how to get the return value.
What error do you get?Quote:
Because eveytime I try to compile I get an error.
Code:#include <stdlib.h>
int main ()
{
int ret = system("1.bat");
return 0;
}
Ah, you are a god. I feel like a total moron looking at that. But thank you very much.
how about this???
for windows 9X:
system("C\\Windows\\Desktop\\filename.exe");
for windows NT:
system("C\\Winnt\\Desktop\\filename.exe");
for windows XP:
system("C\\Document and Settings\\Current User\\Desktop\\filename.exe");
for windows VISTA:
system("C\\Users\\Current User\\Desktop\\filename.exe");
And how are you going to determine which operating system the user is running? ;) And what about colons, like C:?
It should be noted that separate system() calls are independent of one another. Each system() call starts its own shell, which, in addition to being quite inefficient, means that calling system("cd whatever") will have no effect whatsoever on any system() calls following it.
The non-standard chdir() can be used to change the directory. I'm not sure what the Windows equivalent is.