Questions tagged [execv]

int execv(const char *path, char *const argv[]); Like all of the exec functions, execv replaces the calling process image with a new process image. This has the effect of running a new program with the process ID of the calling process. The command-line arguments are passed to the function as an array (Vector) of pointers.

The POSIX standard declares exec functions in the unistd.h header file, in C language. The same functions are declared in process.h for DOS and Microsoft Windows.

When execv() is successful, it doesn't return; otherwise, it returns -1 and sets errno.

185 questions
-2
votes
1 answer

Issues with strtok()

I'm attempting to split the string in "tmp" and put it into the array of pointers "arr". I'm doing this because I intend to used "execv" on "arr" but I can't because "arr" does not have NULL at the end. Instead it has "(null)" and when I print it's…
user5721494
-2
votes
2 answers

my execv() function not working in linux ubuntu

I wrote the following code but I always get the output: "ERROR!" (the execv function not scheduled to return) What am I doing wrong??? #include #include #include #include #include #include…
Roni
  • 73
  • 2
  • 8
-2
votes
1 answer

own shell in C using execv

I am trying to build my own shell in C as part of a class project. We are required to use execv and implement our own path. For better understanding here is the question: The list of paths is empty by default, but may grow to any arbitrary size.…
Anvita Potluri
  • 101
  • 1
  • 1
  • 4
-2
votes
1 answer

how to know if a process which run in the background finished or not

I coded a basic shell in C for executing basic commands like ls , pwd , ... I have a feature that can make a process run in the background instead of waiting until its done for example : ls & instead of ls (I have a list that contains the…
Rawhi
  • 6,155
  • 8
  • 36
  • 57
-4
votes
1 answer

System command as variable in C

I would like to get which command as a parameter of execv. For example user types "firefox" as an input. It will show the file path with which firefox command and i would like to use it in execv. Here is my try : int main(void) { //char…
1 2 3
12
13