The code seems to miss to NULL
-terminate arrays[k]
. Make the last entry in arrays[k]
carry NULL
.
Update:
This
if (execvp((const char*) arrays[k][0], arrays[k]) < 1)
should be
if (execvp(arrays[k][0], arrays[k]) == -1)
of even more straight forward just:
execvp(arrays[k][0], arrays[k]); perror("execvp() failed");
as the members of the exec*()
-family of functions return on error only.
Related Posts:
- How to use execvp()
- How to use execvp() to execute a command
- Why does ENOENT mean “No such file or directory”?
- Undefined reference to pthread_create in Linux
- what is the difference between uint16_t and unsigned short int incase of 64 bit processor?
- Openssl : error “self signed certificate in certificate chain”
- Bad File Descriptor with Linux Socket write() Bad File Descriptor C
- Write to .txt file?
- What is the LD_PRELOAD trick?
- connect Error: “No route to host”
- The difference between stdout and STDOUT_FILENO
- Does connect() block for TCP socket?
- where does stdio.o live in linux machine?
- Linux equivalent of I_PUSH
- Display value found at given address gdb
- What can cause a “Resource temporarily unavailable” on sock send() command
- Efficient way to find task_struct by pid
- valgrind – Address —- is 0 bytes after a block of size 8 alloc’d
- error: aggregate value used where an integer was expected
- Implementing shell in C and need help handling input/output redirection
- Writing a simple shell in C using fork/execvp
- Implementation of multiple pipes in C
- What is `S_ISREG()`, and what does it do?
- Difference between exec, execvp, execl, execv?
- GDB no such file or directory
- How big can a 64 bit unsigned integer be?
- How does strtok() split the string into tokens in C?
- What is *(uint32_t*)?
- what is Segmentation fault (core dumped)? [duplicate]
- How to convert an int to string in C?
- How to print in C
- Why should we typedef a struct so often in C?
- What is a string of hexadecimal digits?
- What is newline character — ‘\n’
- What does the question mark character (‘?’) mean?
- makefile:4: *** missing separator. Stop
- Stack smashing detected
- How do I determine the size of my array in C?
- Undefined reference to pthread_create
- What is Bit Masking?
- segmentation fault : 11
- What are .a and .so files?
- So what does “return 0” actually mean?
- warning: assignment makes integer from pointer without a cast
- Why use bzero over memset?
- How do I use extern to share variables between source files?
- Cannot assign requested address – possible causes?
- ARM Assembler – How do I use CMP, BLT and BGT?
- Invalid read of size 8 – Valgrind + C
- error: called object is not a function or function pointer
- munmap_chunk(): invalid pointer
- warning: incompatible implicit declaration of built-in function ‘xyz’
- strcpy vs strdup
- Warning comparison between pointer and integer in C language
- No Symbol Table using GDB on Compiled Programs
- What is char ** in C?
- Difference between scanf() and fgets()
- Return char[]/string from a function [duplicate]
- Is there a printf converter to print in binary format?
- What is a bus error? Is it different from a segmentation fault?
- Get the current time in C
- C: linker command failed with exit code 1
- What’s the equivalent of new/delete of C++ in C?
- sizeof float (3.0) vs (3.0f)
- Get text from user input using C
- How to trigger SIGUSR1 and SIGUSR2?
- How do I lowercase a string in C?
- warning: expression result unused
- error: indirection requires pointer operand (‘int’ invalid)
- What is the difference between exit(0) and exit(1) in C?
- What does “%.*s” mean in printf?
- How to print a char array in C through printf?
- How to clear all the elements of array in C?
- Variable warning set but not used
- Expected declaration specifier error in function
- strcmp not working
- C char* to int conversion
- char pointers: invalid conversion from ‘char*’ to ‘char’?
- What are the different versions of exec used for in C and C++?
- Running a Python script from PHP
- Is there any simple way to benchmark Python script?
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- What does set -e mean in a bash script?
- Does C have a string type?
- What are .axf files?
- printf format specifiers for uint32_t and size_t
- What is an simple example of copy_from_user
- typedef struct pointer definition
- Return a `struct` from a function in C
- Reaching EOF with fgets
- C: scanf to array
- What are “prototypes” in a C program?
- What’s the difference between “mod” and “remainder”?
- undefined reference to `std::ios_base::Init::Init()’
- previous declaration of ‘function’ was here in C [duplicate]
- How to Compare 2 Character Arrays [duplicate]
- error: `itoa` was not declared in this scope
- What is “-bash: !”: event not found”
- Colors in bash after piping through less?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?