Called the 7z.exe. First search the compressed file in the hard drive, no search to download directly (to be added). Second, the file compression and decompression ... Part of the function to be improved, the code does not have any technical content, nothing more than to maintain the love of technology.
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include <time.h>
const int LEN = 1024;
void ShowTime ();
void Search ();
void Compress ();
void decompress ();
void Help ();
int main ()
{
int n = 0;
while (n!=5)
{
ShowTime ();
printf ("================================================= \ n");
printf ("+++++++++++++++++++++++++++++++++++++++++++++++++ \ n");
printf ("1++++++++++++++++++++search+++++++++++++++++++++1 \ n");
printf ("2+++++++++++++++++++compress++++++++++++++++++++2 \ n");
printf ("3+++++++++++++++++++decompress++++++++++++++++++3 \ n");
printf ("4+++++++++++++++++++++help++++++++++++++++++++++4 \ n");
printf ("5+++++++++++++++++++++exit++++++++++++++++++++++5 \ n");
printf ("+++++++++++++++++++++++++++++++++++++++++++++++++ \ n");
printf ("================================================= \ n");
printf ("Please select action type: \ n");
scanf ("%d", &n);
Switch (n)
{
Case 1:search ();
Case 2:compress ();
Case 3:decompress ();
Case 4:help ();
Case 5:return 0;break;
default:printf ("Input error \ n");
}
}
return 0;
}
void ShowTime ()
{
time_t now;
now = time (NULL);
printf ("%s", CTime (&now));
Sleep (1000);
System ("CLS");
}
void Directorylist (LPCSTR Path)
{
Win32_find_data FindData;
HANDLE Herror;
int filecount = 0;
Char Filepathname[len];
Char Fullpathname[len];
strcpy (Filepathname, Path);
strcat (Filepathname, "\\*.*");
Herror = FindFirstFile (Filepathname, &finddata);
if (Herror = = INVALID_HANDLE_VALUE)
{
printf ("Search failed!");
Return
}
while (:: FindNextFile (Herror, &finddata))
{
if (strcmp (Finddata.cfilename, ".") = 0
strcmp (Finddata.cfilename, "..") = = 0)
{
Continue
}
wsprintf (Fullpathname, "%s\\%s", path,finddata.cfilename);
filecount++;
printf ("\n%d%s", FileCount, Fullpathname); This article links http://www.cxybl.com/html/wlbc/Php/20130626/38826.html