I'm working on some code that writes a large data string (array of bytes)
to a compressed file the following way:
int iBufLen = 12000;
. . . (fill in buffer with 12000 bytes) . . .
pfd = popen ("compress > myfile", "w");
iNumWrote = fwrite (buffer, sizeof(char), iBufLen, pfd);
My actual code is slightly different and has checks return value of popen
This seemed to work fine on my IRIX 5.3. Then one day I got the following
error: pclose would return with value < 0 and errno would be set:
errno = 10 (No child processes)
Meanwhile, the compressed files were created with no problem. Apparently
the compress process finished before pclose was executed? So I ignore this
error. Now when the code is run on different UNIX platforms (ie. HP, Sun, IBM...)
other, different error's are raised which I haven't pinpointed yet, but are
Has anyone dealt with this type of problem?
What happens when the buffer size exceeds the system's pipe buffer size?
- + - + - + - + - +- + - + - + - + - +- + - + - + - + - +- + - + - + - + - +