Hi,
I'm trying to create a simple unix shell. Right now I'm having problems inputting the command and arguments that a user types in. I need to pass them off to execvp to execute the command. This is what the call to execvp looks like:
int execvp(const char *file, char *const argv[]);
So, I need to get the command as char* and the arguments as char*[]. This is what I tried to do, but got a segmentation fault:
char *c;
cout << "command: ";
cin >> c;
cout << "args: ";
char* args[128];
cin >> args[0] >> args[1];
Any idea how to do this properly? Thanks!
--jumpy