Using the language C and Netbeans 8.0.2 I'm trying to read a set of characters, of two files and pass those characters to a method called Patmat which is used to compare them.
The Patmat method has three arguments.The int argument is the number of mismatches that could have and other two character arguments are the file contents.
Below is the Patmat method which I got from an article and there is a long process inside it to compare.
int Patmat(int k, char *pattern, char *text){
}
Here is my main method
int main() {
FILE *fp1;
FILE *fp2;
char c;
char c2;
fp1= fopen ("file1.txt","r");
fp2= fopen("file2.txt","r");
while(1)
{
c = fgetc(fp1);
if(c==EOF)
break;
else
printf("%c", c);
}
while(1)
{
c2 = fgetc(fp2);
if(c2==EOF)
break;
else
printf("%c", c2);
}
fclose(fp1);
fclose(fp2);
**// Patmat(0,&c,&c2);
Patmat(0,c,c2);**
return 0;
}
As i'm not much familiar with C and pointers can anyone help me to pass those character sets of two files to the Patmat method? It does not work as above.
The content of two files are :
file1.txt: AGGTACCGTA
file2.txt: AGGTACCGTA
I directly passed those arguments as Patmat(0,"AGGTACCGTA","AGGTACCGTA"). It worked fine and returned the answer as 1 which is correct.
But now I want to read those character sets from a file and pass them to the Patmat method. It gives the following warning:
warning: passing argument 3 of 'Patmat' makes pointer from integer without a cast
warning: passing argument 2 of 'Patmat' makes pointer from integer without a cast
Thanks in advance and sorry if I made any inconvenience. This is my first attempt to post a question here.
while-loops to do? - alkcandc2aren't character sets, they're single characters. - melpomenecharvariable is a single byte, it can only contain single character. - Blastfurnace