I need to store numbers from the text file to array to compare with another file to know how many numbers in this two files is the same number. One is a text file and another one is a binary file, So I think I need to use fgets
to read it and store it in my array to compare the two of them But I don't know how to store it into the array.
This is an example of information in the file
472287848
348806518
873619952
462254724
701436029
537313066
and I try this one
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
char text[1000001];
char buffer[1000];
fp = fopen("txt100000.txt", "r");
for(int i =0; i<1; i++)
{
fgets(text, 1000001, fp);
buffer[i]=text;
}
fclose(fp);
for(int i =0; i<strlen(buffer); i++)
{
printf("%s", buffer[i]);
}
}
can you tell me how to make it work please?