0

I am running a program that a given points do a system call to zip some files.

The first time it runs properly, but the next time (and also the next ones) it fails with a -1 error code.

sprintf(zip, "zip -q -T -m -r %s/datsiter%d.zip %s/*%d.dat", dir, it_number, dir, it_number);
ierr = system(zip); 
printf("Output:%s %d\n ",zip, ierr);

The output is:

Output:zip -q -T -m -r results/datsiter0.zip results/*0.dat 0
Output:zip -q -T -m -r results/datsiter1.zip results/*1.dat -1
Output:zip -q -T -m -r results/datsiter2.zip results/*2.dat -1

If after the run I execute the commands manually, it works as expected.

EDIT Following kaylum suggestion I added perror("Error: "); just after system call and got the key. A nice Cannot allocate memory that I'll have to check carefully since I'm working in a cluster with a queue system.

1 Answers1

0

Following kaylum suggestion I added perror("Error: "); just after system call and got the key. A nice Cannot allocate memory that I'll have to check carefully since I'm working in a cluster with a queue system.