Hi all,
I'm trying to compare a variable, which stores the md5sum of a file, to a variable which already has the md5sum within it. Here's what i have-
The problem is, both the variables store the same md5sum, but it doesn't print the message , md5sum matches to the screen. What's wrong with it?Code:#include <stdio.h> int main() { FILE *fd=popen("md5sum /home/kj/myfile","r"); char buf[128]; char buf2[] = "6aad283ce232c415b61e1d8c190c2b38 /home/kj/myfile"; if(fd) { while(fgets(buf,128,fd)) if(buf2==buf) printf("md5sum matches"); printf("The md5sum stored in buf is : %s",buf); } pclose(fd); }




Reply With Quote