?
Solved

Help with execl()

Posted on 1998-05-14
2
Medium Priority
?
187 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 40 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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