Hi guys I hope anyone can help me. I'm running a simple program in C, running in Solaris 8, and I found a problem while using popen/pclose.
FILE * stream; stream = popen("ps -ef | grep "pattern");
if(pclose(stream)){ printf("Erro no fechamento da stream\n"); }
The pattern in grep command it's just a filter that I use to treat a smaller number of strings. Of course in my code I do some treatment on the stream returned, but I've already removed this treatment and the error keep happening.
The pclose function return an error 256, which using WIFEXITED shows that it's not an abnormal ending of the command and using WSTATUS shows an error 1, which I don't know exactly what means.
Apparently this happens when the command returns a string empty or with only one line.
Does anyone have a clue of what this error means?
Thanks in advance