How to use a execvp-call to do "grep PATH"?

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.

  1. School (University) and Course Number:
    Royal Technical Highschool, ID2206

Thanks for your help!

EDIT: Problem solved!

Anders Branderud

What was the issue ?

Vbe wrote: "What was the issue ?"

My reply:
As I wrote,
"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."

Why I didn't succeed in doing it was because my inparameters were not correct. After reading the manual pages more carefully and searching on google how others did the same, I solved the problem.