파일 압축 해제
#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);
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.