0
1 0 Robin Fernandao
2 0 Christiano Gomez
3 1 Lionel Maradona

I have a file that has content like above and I'm trying to read in while loop fscanf(filename,"%d %d %s",array[i],array2[i],array3[i]); Everything ok without player name. It gives me name without last name.How can I fix it? is there any way to read like this file

STF
  • 1,485
  • 3
  • 19
  • 36
Yasin
  • 3
  • 2

1 Answers1

3

Try this

fscanf(filename,"%d %d %[^\n]",array[i],array2[i],array3[i]);
BLUEPIXY
  • 39,699
  • 7
  • 33
  • 70
haccks
  • 104,019
  • 25
  • 176
  • 264