s8* get_file_md5(s8 *file)
{
s8 cmd[256] = {0};
static s8 md5[128] = {0};
FILE *fp = NULL;
snprintf(cmd, 255, "md5sum %s |awk '{print $1}'", file);
fp = fopen(cmd, "r");
if(fp)
{
fgets(md5, 64, fp);
fclose(fp);
fp = NULL;
return md5;
}
else
{
return -1;
}
}
网友评论