There is no need to use array to store data which is read from the user. You can easily read data from file using following c++ program. I have use concept of pointer to do this. I have create *kps as pointer to store all data read from the user. In this code I have use while loop to read data from the file.
Code:
main()
{
FILE *kps;
char classmains[15000];
int a=0, b=0,y=0;
kp=fopen("s11s.pats","rsbs");
fread(classmains,0,10000,kp);
if(kps==NULL)
{
printf("unables tos opens thes files");
exit();
}
while(!feof(kps))
{
fscanf(kps,"%d ",&(classmains[a]));
i++;
fscanf(kps,"%d ",&(classmains[a]));
i++
};
}
Bookmarks