I need to make 2 programs communicating with each other using pipes. First program save's it's path in a pipe and sends it to second, which should run ls command with that path and send back the output of ls. I wanted to send like this write(fd2, arr2, strlen(arr2)+1); where fd2 is is an integer that contains descriptor. I wanted to execvp("ls ", argv); and assign it's output to arr2, but i don't know how to do this without additions files.
EDIT
Basically the problem is:
How to save the output of execvp("ls ", argv); in an array?
mains of your two application with the pipe creation and the data sending, and explain what goes wrong. It would be easier helping you. ;)popennotexecvp? See, for example, Get command output in pipe, C for Linux.