When you use fgets(), you are reading from a file, right? So the third parameter is to tell fgets() where to get the input. Just like gets() is getting the input from the standard input (you type the input manually), fgets() will get the string or input from a file.
And you want to use fgets() to read the string "Peter", "John", and "Mary" from the file. So first of all you open the file:
FILE * f;
f = fopen ("myFile.txt" , "r");
char name[100];
fgets ( name, 100, f );
Then 'name' will store the string "Peter". It stops at the newline after "Peter". So it will not read "John" and "Mary" unless you use a loop to make it run multiple times. Or of course you can do it manually:
char name[100];
char name2[100];
char name3[100];
fgets ( name, 100, f );
fgets ( name2, 100, f );
fgets ( name3, 100, f );
It works but it is not the best approach.