Reputation: 11
I have a created name.txt file which contains name of students. I want to find the position of each name using it in C.
here is my main C code for extracting name.txt .
FILE *fp;
char c;
char name[100];
fp = fopen("name.txt", "r");
int ct=0;
while(c != EOF)
{
c = fgetc(fp);
int i = 0;
name[i] = c;
printf("%c",name[i]);
}
And here is the contents name.txt file
1)Liam
2)Olivia
3)Noah
4)Emma
5)Oliver
6)Charlotte
7)Elijah
8)Amelia
9)Bob
10)Roy
Upvotes: 0
Views: 102