redirecting stdout to /dev/null and stderr to stdout?
hiho@ll
what i want: execute another programm within my C app using popen(); and check if an error occured how i try it: Code:
FILE *fp = popen("someprog someparams 1>/dev/null 2>&1","r"); redirect stdout to dev null and stderr to stdout, so i can read using popen and i only get stderr just a simple schematic example: "tar blablabla 1>/dev/null 2>&1" --> i get nothing "tar blablabla" --> i get the error to stdout i wanted to read from stdin another possibility would be redirect stderr to a file and check if the file is empty Q1: any suggestion, how i can do the redirection, so it works? OR how can i read stderr instead of stdout using popen? Q2: any other option other than creating a file? thx@ll! |
aaarrrgghh
forget about it system(); returns the exit status of the prog |
All times are GMT -5. The time now is 10:58 PM. |