Solved

C Programming: Execl permission denied

Posted on 2013-11-18
1
667 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Finding a good hash function 4 127
Programming Arduino to control a Max7219 using C 2 142
Computer slow / BSOD 10 64
SQL Server 2008 R2, need a pivot/cross tab query... 4 29
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…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

828 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