Does anyone know how to catch the output (I think its stdout) from execvp instead of the system printing it (in c on linux) in the terminal?
Does anyone know how to catch the output (I think its stdout) from execvp
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
execvpreplaces the current running process in memory. There’s no “catching” the output.I suspect you’re trying to run an external process from an existing process, and parse its output. For that you need to use
popen()which does afork()then anexec(), returning aFILE *to read (which will be thestdoutof the process you just ran).