Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > pl.comp.os.linux.programowanie > #2089
| Path | csiph.com!aioe.org!news.mixmin.net!news.unit0.net!news.nask.pl!news.nask.org.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail |
|---|---|
| From | Borneq <borneq@antyspam.hidden.pl> |
| Newsgroups | pl.comp.os.linux.programowanie |
| Subject | Re: Jaka funkcja jak system() ale z podawaniem katalogu roboczego? |
| Date | Wed, 1 Feb 2017 17:16:12 +0100 |
| Organization | ATMAN - ATM S.A. |
| Lines | 33 |
| Message-ID | <o6t1kc$uk2$1@node1.news.atman.pl> (permalink) |
| References | <o6sibv$f31$2@node1.news.atman.pl> <2eTd7vlduI38hNv8%gof@news.chmurka.net> |
| NNTP-Posting-Host | 91.239.205.105 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-2; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | node1.news.atman.pl 1485965772 31362 91.239.205.105 (1 Feb 2017 16:16:12 GMT) |
| X-Complaints-To | usenet@atman.pl |
| NNTP-Posting-Date | Wed, 1 Feb 2017 16:16:12 +0000 (UTC) |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
| In-Reply-To | <2eTd7vlduI38hNv8%gof@news.chmurka.net> |
| Xref | csiph.com pl.comp.os.linux.programowanie:2089 |
Show key headers only | View raw
W dniu 01.02.2017 o 16:59, Adam Wysocki pisze:
> chdir
> exec*
zrobiłem:
dwa pierwsze parametry do ścieżka do shella a następny "-c"
void execSystem(string command, string workDir)
{
const char *defShell="/bin/bash";
const char* shellPath;
shellPath = getenv ("SHELL");
if (shellPath==NULL)
shellPath = defShell;
__pid_t pid = fork();
int status;
switch(pid)
{
case -1: exit(-1);
case 0:
{
chdir(workDir.c_str());
execlp(shellPath,shellPath,"-c" ,command.c_str(),NULL);
}
break;
default:
{
waitpid(pid,&status,WUNTRACED);
}
}
}
Back to pl.comp.os.linux.programowanie | Previous | Next — Previous in thread | Find similar
Jaka funkcja jak system() ale z podawaniem katalogu roboczego? Borneq <borneq@antyspam.hidden.pl> - 2017-02-01 12:55 +0100
Re: Jaka funkcja jak system() ale z podawaniem katalogu roboczego? gof@somewhere.invalid (Adam Wysocki) - 2017-02-01 15:59 +0000
Re: Jaka funkcja jak system() ale z podawaniem katalogu roboczego? Borneq <borneq@antyspam.hidden.pl> - 2017-02-01 17:16 +0100
csiph-web