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
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