I'm trying to use 7-Zip to zip up a file via the system()
function in C++ on a windows XP machine.
I tried:
(formatted to be what system() would have received)
"C:\Program Files\7-Zip\7z.exe" a -tzip "bleh.zip" "addedFile.txt"
which spat the error
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
I've tried several similar alternatives but have not yet found a solution.
I want to try to run it straight from its install directory so that as long as a user has 7-Zip installed it will be able to function. This is for an in house utility application.
EDIT: as requested these are the actual lines of code:
std::string systemString = "\"C:\\Program Files\\7-Zip\\7z.exe\" a -tzip \"" + outDir + projectName + ".zip" + "\" \"";
//...
std::string finalSystemString = systemString + *i + "\"";
system( finalSystemString.c_str() );
*i
is an iterator to a particular file that is getting added.