From: juhkivij AT utu DOT fi (Juha Kivijärvi) Newsgroups: comp.os.msdos.djgpp Subject: Problem with long parameters to system() Date: 19 Oct 1998 12:34:50 GMT Organization: University of Turku, Finland Lines: 58 Message-ID: <70fbla$4jm$1@news.utu.fi> NNTP-Posting-Host: alya.utu.fi X-Trace: news.utu.fi 908800490 4726 130.232.2.13 (19 Oct 1998 12:34:50 GMT) X-Complaints-To: usenet AT news DOT utu DOT fi NNTP-Posting-Date: 19 Oct 1998 12:34:50 GMT X-Newsreader: TIN [UNIX 1.3 950824BETA PL0.utu] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I use DJGPP 2.0 / GCC 2.7.2 to compile these two short programs: /* ------- a.c ------------------------ */ #include void main(int argc, char* argv[]) { printf("%s\n", argv[1]); } /* ------- b.c ------------------------ */ #include #include #include void main() { printf("system:\n"); system("a 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O"); printf("execl:\n"); execl("a", "", "123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O"); } /* ------------------------------------ */ Now, when I run b.exe, I get the following output: system: 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L12345 execl: Exiting due to signal SIGSEGV Page fault at eip=0000676a, error=0004 eax=00008e00 ebx=000000b0 ecx=ffffffff edx=00052f1c esi=00000004 edi=00000001 ebp=00053018 esp=00052f1c cs=00a7 ds=00af es=00af fs=008f gs=00bf ss=00af Call frame traceback EIPs: 0x0000676a 0x00006ebd 0x00002977 0x000016c3 0x00001bfb This raises two questions: 1) Why does system() call seem to truncate the command line to 128 characters although the info page states that this shouldn't happen when calling other DJGPP compiled programs? What to do? 2) What am I doing wrong with execl()? This doesn't seem to have anything to do with the length of the parameter. Furthermore, replacing "" by "a" doesn't help. Thanks for your time. " Juha Kivijarvi juhkivij AT utu DOT fi