Questions tagged [execl]

execl() is a C library function which is used to replace the current process image with a new process image. It belongs to the family of exec() functions and prototyped in unistd.h.

execl() is a C library function which is used to replace the current process image with a new process image. It belongs to the familt of exec() functions and prototyped in unistd.h.

The Function Prototype

int execl(const char *path, const char *arg, ...);

where,

  • The first argument is the name of a file that is to be executed.
  • The const char *arg and subsequent arguments (if any) can be thought of as arg0, arg1, ..., argn. Together they describe a list of one or more pointers to null-terminated strings that represent the argument list available to the executed program.

Return Value

The various exec() functions only return if an error has occurred. The return value is -1, and errno is set to indicate the error.

Check the Main page for more details.

120 questions
1
vote
2 answers

Exec fails due to Bad Address

I have a serious problem with exec.I've tried both options with list(execl) and array(execv) but the problem remains.I'll give the function in which i try to make the call. #include #include void MyFunc(string…
JAM AICA
  • 91
  • 1
  • 10
1
vote
1 answer

Piping between two programs in C

I've been stuck on getting piping to work between two programs for the last couple of hours and I'm stuck and not sure if I'm doing something wrong. The idea of my program is that I'm going to use interface.c to open a pipe, and then execute db.c. I…
1
vote
2 answers

how to check if execl() is success (multiple process)

I created multiple child processes by fork() and had them run executable file by execl(). I want to check if there is any execl() that is failed (ex: try to execute non-exist file). By, try to execl() all the programs and if one of them is failed…
Tran Van Boi
  • 27
  • 1
  • 7
1
vote
1 answer

execl & printf - order

I have a small problem with this: { printf ("abc"); execl("./prog","prog",NULL); } All works fine, but why does execl just run before printf? Could someone help me?
wienio
  • 13
  • 4
1
vote
1 answer

Linux how to spawn child process using parameter from argv[] in C

I want to create a program msh that will recognize some other C programs I wrote and spawn a new process for that C program and run it. For example I have already written my own copy, move, and remove functions named mycopy, myremove, and mymove. I…
Mkey
  • 155
  • 1
  • 4
  • 12
1
vote
2 answers

Call execl on a non-const char[]

I'm getting the comand from keyboard in a vector and I want to use in execl(), but execl() takes a const char *. Is there another function similar to execl I can use that takes char* parameters, or how can I call execl with my char*? void…
1
vote
0 answers

Execlp says No such file or directory

I am trying to do ps -A in code, but typing execlp("/bin/ps", "ps", "-A", NULL); outputs: /bin/ps: No such file or directory But I can see ps in the file directory so I have no idea what is wrong.
atg
  • 127
  • 2
  • 13
1
vote
1 answer

Unable to launch jar with execl()

I was given a decrypt.jar and encrypt.jar file, which are used to prepare files before transmitting. When I launch the terminal and type: /usr/bin/java -jar /path/to/jar/decrypt.jar I get the output: No input file specified Which is OK! The jar…
adnan_e
  • 1,764
  • 2
  • 16
  • 25
1
vote
1 answer

How to run my stdin through the cut command using the execl() function?

My objective is to make an IPC between a child and parent through a FIFO. The child should run execl ("/bin/cat", "cat", "/etc/passwd", (char *)0); redirect its output to the parents input and the parent should run this command: cut -l : -f 1 and…
1
vote
1 answer

Print pipe content to screen

I am using the execlp() to execute commands on child process and save into a pipe to be read by parent as such for example int pipefd[2]; if (pipe(pipefd)) { perror("pipe"); exit(127); } if(!fork()){ close(pipefd[0]); dup2(pipefd[1],…
Khaled
  • 8,255
  • 11
  • 35
  • 56
1
vote
1 answer

C - fork() & execl() & loop + "half pyramid output"

I have a troubles with the following. Let's say, I have a two programs, one is "input.c" and second is "output.c". Output is a simple one and looks like this (I will paste only the most important passage). outputbin.c // char…
Yeez
  • 282
  • 1
  • 3
  • 9
0
votes
0 answers

Problem with running another instance of a ncurses-based program from within the program itself using fork() and execl()

I have a C program which implements a small ncurses-based plain-text editor. The program can open only a single file during its runtime. The program is invoked from the command line as $ ./tedit . When invoked from the command line the…
wangyu00
  • 1
  • 1
0
votes
0 answers

Refresh Execl Charts after upating data in c#

I have an Excel file that contains pivot tables and charts all those depend on data in another sheet X. The data in the concerned sheet X is loaded from Datatable. The problem I have is when I work on the origin file and enter the new data manually…
0
votes
0 answers

How to find last column on concrete range on appScript?

I faced with easy routine question, but can't find solution. My task to find value of last column on concrete range. How I try to find it? function sales() { var ss1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("All data"); var…
arsonee
  • 11
  • 1
0
votes
1 answer

ncurses and key codes after fork

I don't understand why the arrow keys code changes after forking in a WINDOW. The up arrow returns 259, but after the fork 65. If I run the same program on stdscr, it returns 65 already at the beginning. Thanks for the help and sorry for the english…