Mail Archives: djgpp/1998/06/13/09:30:23
Gerhard Gruber wrote:
> >basically, net view from the command line will do it.
> >
> >unfortunantly, i can't get "net view" to work in my execve() function.
> >
> >execve("//kyle/c$/winnt/system32", "net", "view");
> >
> >gives me two errors. 1) incompatible pointer type, Argument 2
> >2) Incompatible argument type, argument 3.
> >
> >so...what am i doing wrong? please help.
>
> int execve(const char *path, char *const argv[], char *const envp[]);
>
> You are giving a const char * instead of an array. Either you have to use
> another function or you must setup an array with the arguments and environment
> and pass this on.
Plus, the "const char *path" argument is the complete pathname to the
executable, i.e. "//kyle/c$/winnt/system32/net.exe". So your function
call should be.
execve("//kyle/c$/winnt/system32/net.exe",args,envp);
Assuming you set up "args" and "envp" as the proper arrays.
- Raw text -