Don't know the answer to your question until I know the contents of the text file. Without that knowledge, generally I would use fgets() to read a line, then parse it into its individual parts into the structure.
Ancient Dragon
Retired & Loving It
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
you could do something like this:
fscanf(fp,"%s%s%s", List[i].ID, List[i].YR, List[i].lname);
// get the first name separately because it may be composed of
// two or more names with spaces, so fscanf() will not work with this.
fgets(List[i].fname, sizeof(List[i].fname, fp);
Of course you will have to put the above in a loop after opening the file for reading.
Ancient Dragon
Retired & Loving It
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
i have to read two text file
"textfile.txt" and "textfile2.txt"
it only reads "textfile.txt"
how to join the two text and read it.
Open both text files and just read each of them. Only you can answer your question because we have no idea what the hell you are talking about.
Ancient Dragon
Retired & Loving It
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341