Storing the result of execvp to a char array in C
I would like to know how to store the result of execvp to a char array. Below is my code:
Code:
int main () { J |
I understand what you're trying to achieve, but don't see an easy option for you. The program executed by execvp will place it's output on file descriptor #1 (aka, stdout). You could redirect this to a file or similar using freopen in the fork. MMap can back a file using memory mapping, I wonder if there is something in the reverse... (named pipe, perhaps?)
Perhaps something like: Code:
char *fname="pipeXXXXXX"; |
Thanks... I'll look more into it... Can I use popen?
|
I modified my code using popen and fopen...
Code:
int main () { "I'm the child. [pegasus SHELLed ~]$ sh: 4: command not found" How do I fix this? THanks in advance. |
All times are GMT -5. The time now is 04:15 PM. |