R
rveloso
Hi all, i'm having a really nasty problem with popen.
I have the following code :
---------------------
....
FILE *PD;
....
sprintf(fname,"/usr/bin/gzip -dc %s/%s",dirname,dp->d_name);
....
if((PD = popen(fname, "r"))==NULL){
fprintf(stderr,"%d: Failed opening pipe to %s\n",errno,fname[file]);
exit(-1);
}
....
pclose(PD)
....
---------------------
Now the popen is in a cycle and should open about 250 files in the same
dir.
The weird thing is that it always stops at file 100, no matter which
file it is, and I get the following
error message:
"12: Failed opening pipe ..."
doing perror 12 i get:
"Error code 12: Cannot allocate memory"
I don't understand why popen cannot allocate memory - any suggestion?
Thanks!
rveloso
I have the following code :
---------------------
....
FILE *PD;
....
sprintf(fname,"/usr/bin/gzip -dc %s/%s",dirname,dp->d_name);
....
if((PD = popen(fname, "r"))==NULL){
fprintf(stderr,"%d: Failed opening pipe to %s\n",errno,fname[file]);
exit(-1);
}
....
pclose(PD)
....
---------------------
Now the popen is in a cycle and should open about 250 files in the same
dir.
The weird thing is that it always stops at file 100, no matter which
file it is, and I get the following
error message:
"12: Failed opening pipe ..."
doing perror 12 i get:
"Error code 12: Cannot allocate memory"
I don't understand why popen cannot allocate memory - any suggestion?
Thanks!
rveloso