To me that code looks like it prints the first line of the file, not the first word. Fgets should read until either a newline or an EOF is received or until the specified limit is reached (you are missing the limit parameter).
..actually the first parameter to fgets should be the str, and third parameter the file.