c - Check for duplicate entry from text file -
i'm creating simple program, want add together entry item records. if item found on record, display error message. otherwise, print new line text file.
file *fp; fp = fopen("data.txt","r+"); printf("enter name:"); scanf("%s",&result); while(fscanf(fp,"%s",searchname) == 1) { if(strmp(searchname,result)) //do }
how display errror message if found in record , print new line if doesn't exist in record ?
i think want strcmp not strmp
per post.
you can utilize
if(strcmp(searchname,result) == 0){ printf("error : in record\n"); break; } else //code add together record
c file duplicates printf
No comments:
Post a Comment