| www.delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| From: | "one2001boy AT yahoo DOT com" <one2001boy AT yahoo DOT com> |
| User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040514 |
| X-Accept-Language: | en-us, en |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | ls.exe in execv |
| Lines: | 36 |
| Message-ID: | <Id3Id.13792$5R.2943@newssvr21.news.prodigy.com> |
| NNTP-Posting-Host: | 68.124.185.24 |
| X-Complaints-To: | abuse AT prodigy DOT net |
| X-Trace: | newssvr21.news.prodigy.com 1106296808 ST000 68.124.185.24 (Fri, 21 Jan 2005 03:40:08 EST) |
| NNTP-Posting-Date: | Fri, 21 Jan 2005 03:40:08 EST |
| Organization: | SBC http://yahoo.sbc.com |
| X-UserInfo1: | TSU[@IONEZVSSWLSX@]D]_\@VR]^@B AT MCPWZKB]MPXHNDQUBLNTC AT AWZWDXZXQ[K\FFSKCVM AT F_N_DOBWVWG__LG@VVOIPLIGX\\BU_B@\P\PFX\B[APHTWAHDCKJF^NHD[YJAZMCY_CWG[SX\Y]^KC\HSZRWSWKGAY_PC[BQ[BXAS\F\\@DMTLFZFUE@\VL |
| Date: | Fri, 21 Jan 2005 08:40:08 GMT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Hello,
In windows,
does anybody know if there is a solution for not hanging when run
execv()? it seems that running notepad.exe is fine, however, running
"ls.exe" compiled with djgpp will hangup the application. Here is the
the sample code.
#include <windows.h>
#include <stdio.h>
int main() {
char ** environ=_environ;/**** SYSTEM DEFINED ENVIRONMENT POINTER */
int retval;
/* this is OK
char *argv[] = {"C:\\WINDOWS\\SYSTEM32\\notepad.exe", NULL};
retval = execv("C:\\WINDOWS\\SYSTEM32\\notepad.exe", argv);
*/
/* this will hang
*/
char *argv[] = {"C:\\bin\\ls.exe", "C:\\", NULL};
retval = execv("C:\\bin\\ls.exe", argv);
printf("if successful, this should not be printed out\n");
if(retval == -1) {
fprintf(stderr, "ERROR: 'exec' failed\n");
perror("exec");
exit(-1);
}
exit(0);
}
thanks.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |