Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pclose returns -1 in solaris 10

Status
Not open for further replies.

smadhans

Programmer
Jun 28, 2011
1
US
Hi,
Below is the snippet code:

File *fptr;
char filebuf[300];
if ((fptr=popen("ls -ltr ","r")) != NULL)
{
while(!feof(fptr))
{
memset(filebuf, '\0', sizeof(filebuf));
if(fgets(filebuf, sizeof(filebuf), in1) != NULL)
{
printf("%s",filebuf);
}
}
}
if (pclose(fptr)==-1)
{
printf("\n pclose error ");
}

In the above code, the poopen command executed successfully, when it tries to perform pclose, it throwed an error "pclose error".

Above code has been executed in
SUN OS 5.10 Generic_142909-17 sun4u sparc SUNW,SPARC-Enterprise

Did anyone came across this issue earlier.
If yes, please help me out on your suggesstions.

Thnkx
 
You posted this in the wrong forum. This forum is intended for Perl problems, so you probably won't get much help.

As of your problem, I would do a perror to get more information.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top