![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with socket binding - "system" call | Janardhanbr | High Level Programming | 5 | 05-10-2009 09:48 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| grep to find content in between curly braces, "{" and "}," | keshav_rk | Shell Programming and Scripting | 4 | 08-09-2007 10:14 PM |
| error "Invalid argument" returned after call sched_setscheduler | robin.zhu | High Level Programming | 1 | 07-26-2007 03:51 AM |
| Network Path Not Found Error "Sunfire V100" | louisd11 | SUN Solaris | 4 | 12-13-2006 01:20 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Problem solved! 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. 4. School (University) and Course Number: Royal Technical Highschool, ID2206 Thanks for your help! EDIT: Problem solved! Anders Branderud proofofaCreator.wordpress.com Last edited by andersbranderud; 4 Weeks Ago at 05:45 AM.. |
|
||||
|
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. Last edited by pludi; 3 Weeks Ago at 06:33 AM.. Reason: removed self promotion |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|