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
0
votes
0 answers

_execl() funcution on windows 10 platform to rename the process

I am trying to rename the current running process name using c programming language but getting error here the code which I had done #include #include #include Int main(int argc ,char…
rohan k
  • 1
  • 1
0
votes
1 answer

how to use execl to send a pointer as command line argument to another program

I am trying to accepts two integers (say low and high) as command line argument and in my main program is trying to call two other programs. program-1 should calculate the summation of all integers between (low, high) as sum_res and program-2 should…
0
votes
1 answer

Error while running prngd: Failed to execl

In my linux embedded device, I run prngd in the following way: prngd /var/run/egd-pool In the system log I am getting the followiong errors: 192.168.8.195.34453:<29>Jan 1 00:04:49 prngd[132]: prngd 0.9.29 (12 Jul 2004) started up for user…
harlem
  • 23
  • 1
  • 5
0
votes
0 answers

How can I copy the number of bytes of the output before piping in C?

I have a C program that can pipe multiples processes together here's a running example: ./a.out cat test ; grep left ; wc -c It basically pipes the output of cat test to grep left and grep left to wc -c I want to add a function that will copy the…
0
votes
0 answers

Why am i not able to get output from pipefd[0] and not getting printed?

#include #include #include #include int main(){ int pipefd[2]; int status = pipe(pipefd); int child = fork(); printf("%d",child); if(!child){ wait(NULL); …
0
votes
2 answers

use rm linux order in execl() function ic C language

hope to be fine... i'm trying write code that use execl within execl in C language but it's not working when i put the directory of file. the code is: #include #include #include #include int main(int…
Mazen AS
  • 9
  • 2
0
votes
0 answers

Why does read() not succeed until after the process is killed?

I'm working on a project that allows a UNIX system to communicate with another machine via a serial connection using cu(1.07). The following is the approximate framework of the program I'm trying to use, with all of the error-checking and such…
Willis Hershey
  • 1,520
  • 4
  • 22
0
votes
1 answer

How to keep header and delete all data?

I am trying to keep the first row and remove/delete all data of sheet named "Main". My below code does not remove any data from the sheet named "Main". Sub clean_sheets() '-------Clear Main Sheet all data will be removed except Header Row----- With…
Sandy
  • 49
  • 7
0
votes
1 answer

how can i run pipe with execl and write result to file?

I try to do something like this in C but I don't know how:( : $: xwd -silent -root | convert xwd:- -crop 1920x1080+0+0 test.png with execl. Now I can do only something like that: #include #include #include…
0
votes
1 answer

usage of _execl() function on Windows10 platform

_execl() is returning -1 and error message as "No such file or directory" even though the given file is there. When I run gzip command directly on command prompt it works. I am not able to understand what is it that I am missing here. #include…
confucius_007
  • 186
  • 1
  • 15
0
votes
1 answer

waitpid getting hooked and not returning

I have a function that is calling a process called driverclear. Seems like the process starts but it never returns because I never get the output of the process and I never get the "Process Complete" message. Is there something I am doing…
adamk
  • 1
  • 1
0
votes
2 answers

Parent/Child and pipes in C, child-parent comunication

I have a parent program that sends a integer to a child, and the child program multiplies the number by two and gives back to the parent. In a main program I create a pipe and fork() and execl() the child, after a switch I pass the value through…
Z xie
  • 9
  • 2
0
votes
0 answers

How to merge commands using execv? eg. ls | grep -c "expression"

I know I can do execl("/bin/ls","-l",(char*)NULL) to output ls. But how do I execute ls | grep -c "file" using execv? In my code I want to search my current working directory for a particular file name. The above command returns 1 if the file…
mjsxbo
  • 2,116
  • 3
  • 22
  • 34
0
votes
0 answers

How to use linux wc command with char array?

Hi~ I'm just making sample program which implements pipe command. In this program, I'm trying to implement "cat somefile.txt | wc" command.. So I called fork() twice, I used first child process for sending results of "cat somefile.txt" to…
Carim
  • 1
  • 3
0
votes
1 answer

execl off by two bytes

I have this code: execl("/bin/ip", "address", "add", "dev", ob->tun_name, "local", ob->local_ip, "peer", ob->remote_ip, NULL ); But I get the error: Object "dress" is unknown, try "ip help". If I use…
fadedbee
  • 42,671
  • 44
  • 178
  • 308