I do not understand your problem. As far as I see, you open a file and read its first word up to the comma, which is "player1". What problem do you have with that?