char* argv[4] = {0};
argv [0] = "/usr/bin/unzip";
argv [2] = "/home/vishvesh.kumar/tempFolder/test.zip";
argv [1] = "-d /home/vishvesh.kumar/tempFolder/";
argv [3] = NULL;
Should be:
char* argv[5];
argv [0] = "/usr/bin/unzip";
argv [1] = "-d";
argv [2] = "/home/vishvesh.kumar/tempFolder/";
argv [3] = "/home/vishvesh.kumar/tempFolder/test.zip";
argv [4] = NULL;
The way you have it, the parameter to -d
is the zip file, since that's the parameter after the -d
. So it tries to create that directory and can't because it's a file.