Help Bus error# Unix - 噫吁兮,危乎高哉
n*r
1 楼
I put a group of Popen command before a function, it is fine.
However, when I put it into a function, it showed always Bus Error
The following is the code
if ((ptr = popen(cmd, "r")) != NULL
{
while (fgets(bufPS, 40, ptr) != NULL)
{
(void) printf("%s", bufPS);
(void) strcat(bufPine,bufPS);
}
pclose(ptr);
}
Help me please!!!
However, when I put it into a function, it showed always Bus Error
The following is the code
if ((ptr = popen(cmd, "r")) != NULL
{
while (fgets(bufPS, 40, ptr) != NULL)
{
(void) printf("%s", bufPS);
(void) strcat(bufPine,bufPS);
}
pclose(ptr);
}
Help me please!!!