Hallo ich habe gerade ein downloader und unzip programm geschrieben jedoch wird die datei nur heruntergeladen aber nicht entpackt was ist nich richtig
Code:
#include <iostream>
#include <cstdlib.>
#include <windows.h>
#include <urlmon.h>
#include <string>
#include <direct.h>
#include "unzip.h" //zum entpacken nötig
using namespace std;
#pragma comment(lib,"URLMon.lib")
void livezilla()
{
// Datei herunterladen
HRESULT result = URLDownloadToFile(
NULL,
TEXT("http://www.livezilla.net/downloads/files/LiveZilla_3.1.8.5_USB.rar"), // URL zur Datei
TEXT("LiveZilla.zip"), // Lokaler Name der Datei
0,
NULL);
/*if (result == S_OK)
{
cout << "LiveZilla.zip erfolgreich heruntergeladen" << endl;
system("PAUSE");
cout << endl;
}
else
{
cout << "Fehler beim Download" << endl;
system("PAUSE");
}
}
void unziplz()
{
HZIP hz = OpenZip("LiveZilla.zip",0,0);
ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
for (int i=0; i<numitems; i++)
{
GetZipItem(hz,i,&ze);
UnzipItem(hz, i, ze.name);
}
CloseZip(hz);
}
void remove()
{
remove("LiveZilla.zip");
cout << "Dateien geloescht" << endl;
system("PAUSE");
cout << endl;*/
}
int main()
{
livezilla();
unziplz();
remove();
}