daidaineteasy
晓呆同学
2020-06-01 11:36

哪位大神能帮把这段C语音的代码翻译成Java代码,跪谢!

5
  • java
  • c语言
int getMabBuf(char* fileName, char* mabBuf)
{
    char sBlock[256+1];
    FILE *pfFileI;
    struct stat fbuf;
    if(stat(fileName,&fbuf) < 0)
    {
        return -1;
    }
    if ((pfFileI = fopen(fileName, "r")) == NULL)
    {
        return -2;
    }
    while (!feof(pfFileI))
    {
        memset(sBlock, 0, sizeof(sBlock));
        fread(sBlock, __BLOCKSIZE, 1, pfFileI);
        Do_XOR(mabBuf, sBlock, __BLOCKSIZE);
    }
    fclose(pfFileI);
    return 0;
}

void doXOR( char* deststr , char* source , int strlength )
{
int i = 0;
for( i = 0 ; i < strlength ; i++ )
{
deststr[i] ^= source[i];
}
}


#define __BLOCKSIZE 256

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答