Hello!
I am learning how to use the function execvp. I have read through the UNIX manual.
I have a process. I run execvp and I command it to do �printenv�. It works fine.
Before I do the execvp-call I pipe STDOUT to go to a specific pipe. After that I restore STDOUT. I read that pipe in another process. I have tested it and it works.
Now in this other process I want to do execvp again and I want to command execvp to do �grep ...�.
I don't succeed in doing this.
Here is some of my code:
char* environment_variables_vector[60];
My function call is this: execvp ("grep", environment_variables_vector)
Environment_variables_vector have this format:
Position 0 is a pointer to the string �grep PATH�
Position 1 is a pointer to: A nulterminated string containing an environment variable
Position 2 is a pointer to: Another nulterminated string containing another environment variable
..etcetera, up to
Position 52 is a pointer to: Another nulterminated string containing another environment variable.
When I run the program it doesn't run the code after the execvp-call.
- School (University) and Course Number:
Royal Technical Highschool, ID2206
Thanks for your help!
EDIT: Problem solved!
Anders Branderud