zoukankan      html  css  js  c++  java
  • 导入密码库

    View Code
    int LoadDictionary()
    {
    FILE *fp;
    fp=fopen("formatpwd.txt","rb");
    fseek(fp,0,SEEK_END);
    size_t DicLength=ftell(fp);
    fseek(fp,0,SEEK_SET);

    char * pbuf = new char[DicLength+1];
    memset(pbuf,0,DicLength);
    fread(pbuf,sizeof(char),DicLength,fp);

    PWD pwd;
    size_t offset=0;
    int pwdlen=0;

    while(offset<DicLength)
    {
    memset(pwd.mpwd,0,16);
    pwdlen=0;
    memcpy(&pwdlen,pbuf+offset,1);
    offset+=1;
    memcpy(pwd.mpwd,pbuf+offset,pwdlen);
    offset+=pwdlen;
    VectPwd.push_back(pwd);
    }
    delete []pbuf;
    pbuf=NULL;
    fclose(fp);
    return yes;
    }

    int LoadDictionaryEx()
    {
    FILE * fp;
    PWD pwd;
    char readbuf[32]={0};
    size_t offset=0;
    fp=fopen("C:\\usualpwd.txt","rb");
    if(fp)
    {
    while(fgets(readbuf,32,fp))
    {
    memset(pwd.mpwd,0,32);
    readbuf[strlen(readbuf)-1]=0;
    memcpy(pwd.mpwd,readbuf,strlen(readbuf));
    VectPwd.push_back(pwd);
    memset(readbuf,0,32);
    }
    fclose(fp);
    return yes;
    }
    return no;
    }
  • 相关阅读:
    环求解点值
    汉诺塔(记录每种路径次数)
    快速排序
    选择排序
    冒泡排序
    桶排序
    异或后最大lowerbit
    计数三角形
    nico和niconiconi
    提高程序设计能力的一般方法
  • 原文地址:https://www.cnblogs.com/guyan/p/2280421.html
Copyright © 2011-2022 走看看