Solved

Help with execl()

Posted on 1998-05-14
2
185 Views
Last Modified: 2010-04-15
I wrote this program that does a few things and then is supposed to call another program. I tried using system(), but i kept getting a message about "Program too big to fit in memory". So i tried using the function execl(). If i try and run it through a DOS box under win95, works like a charm. But if i try and run it from DOS, it dumps and doesnt run.

Here is the basic pseudo-code:
couple of print statments
call one function
execl("C:\\windows\\scan.exe");

NOw when i run it through does i get a message about an error due to SIGNAL SIGSEVE. What does that mean? ANyone know how i can fix this problem?
0
Comment
Question by:GreatOne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Expert Comment

by:marvinm
ID: 1250762
Your call should really be execl("C:\\windows\\scan.exe","C:\\windows\\scan.exe",NULL);
I'm not familiar with SIGNAL SIGSEVE
0
 
LVL 11

Accepted Solution

by:
alexo earned 20 total points
ID: 1250763
SIGSEGV == Illegal storage access. A.k.a. Segment violation.

Check the arguments to execl().  My documentation says:
    int _execl( const char *cmdname, const char *arg0, ... const char *argn, NULL );

Also, I'd suggest using execv() instead of execl()

Example:

    char* prog = "myprog.exe"
    char* args[2] = { prog, NULL };
    execv(prog, args);

If you want to pass command line arguments, make the "args" array bigger and assing the items between the "prog" and the "NULL" to point to the arguments.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question