delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/13/09:30:23

Message-ID: <35827CC6.30239504@ipass.net>
From: Terry <iceman AT ipass DOT net>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help...using execve() in NT
References: <6lsbb1$gjr AT dailyplanet DOT wam DOT umd DOT edu> <358c469c DOT 3186983 AT news DOT Austria DOT EU DOT net>
Lines: 25
Date: Sat, 13 Jun 1998 13:26:16 GMT
NNTP-Posting-Host: ts8-153-ppp.ipass.net
NNTP-Posting-Date: Sat, 13 Jun 1998 09:26:16 EDT
Organization: iPass.Net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019