Solved

C Programming: Execl permission denied

Posted on 2013-11-18
1
684 Views
Last Modified: 2013-11-18
I am new to C programming. Is this the right use of the execl command?

void communicate(const char *port, const char *conf, const char *cwd) {
   ...
   // cwd is /home/users1/pz951772
   execl(cwd,"egress");
   ...
}

egrass.c is a simple C program, that has been GCC'd (gcc -o egress egress.c)
I also did "chmod 777 egress" thinking that I should give it full rights, but that didn't help.

If needed I can post the entire code.
0
Comment
Question by:pzozulka
[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
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 39657116
If you want to launch a program called 'egress', that shoule be more like

 chdir(cwd);
 execl("egress","egress");

Open in new window


See also http://linux.die.net/man/3/execl - the first argument to 'execl()' is th eprograms name, the 2nd the 1st argument to the program, which in turn is equal to the program's name. In your snippet, you were trying to run 'cwd', which does not work and causes that error.
0

Featured Post

Independent Software Vendors: 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

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

734 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