파일 압축 해제

3696 단어
7z를 호출했습니다.exe.먼저 하드디스크 내의 압축 파일을 검색하고 직접 다운로드할 수 없습니다. (추가 필요)그 다음으로 파일의 압축과 압축 해제...일부 기능이 보완되어야 하기 때문에 코드는 어떠한 기술 함량도 없고 기술에 대한 애정을 유지하는 것이 아니다.
#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("               =================================================          
"); printf(" +++++++++++++++++++++++++++++++++++++++++++++++++
"); printf(" 1++++++++++++++++++++Search+++++++++++++++++++++1
"); printf(" 2+++++++++++++++++++Compress++++++++++++++++++++2
"); printf(" 3+++++++++++++++++++Decompress++++++++++++++++++3
"); printf(" 4+++++++++++++++++++++Help++++++++++++++++++++++4
"); printf(" 5+++++++++++++++++++++Exit++++++++++++++++++++++5
"); printf(" +++++++++++++++++++++++++++++++++++++++++++++++++
"); printf(" =================================================
"); printf(" :
"); scanf("%d",&n); switch(n) { case 1 : Search();break; case 2 : Compress();break; case 3 : Decompress();break; case 4 : Help();break; case 5 : return 0;break; default : printf("
"); } } 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(" !"); return; } while(::FindNextFile(hError, &FindData)) { if (strcmp(FindData.cFileName, ".") == 0 || strcmp(FindData.cFileName, "..") == 0 ) { continue; } wsprintf(FullPathName, "%s\\%s", Path,FindData.cFileName); FileCount++; printf("
%d %s ", FileCount, FullPathName); if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { printf("<Dir>"); DirectoryList(FullPathName); } } } void Search() { char path[LEN]; printf("
please input the file Directory
"); scanf("%s",path); DirectoryList(path); } void Compress() { char filename[100] = {'\"'}; char cmd[300] = "7z.dll a "; //DOS printf("
please input the file name
"); scanf("%s", filename); strcat(cmd, "output ");// output strcat(cmd, filename);// system(cmd); //system("cls"); //cmd :"C:\Program Files\WinRAR\winrar" a output filename // a output filename //rar rar printf(" !!
"); Sleep(2000); } void Decompress() { char filename[100] = {'\"'}; char cmd[300] = "7z.dll e "; printf("
please input the file name
"); scanf("%s", filename); strcat(cmd, filename); system(cmd); printf(" !!
"); Sleep(2000); } void Help() { char cmd[300] = {0}; strcpy(cmd,"7z.dll -h"); system(cmd); Sleep(2000); }

좋은 웹페이지 즐겨찾기