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,447
  • 3
  • 18
  • 33
Yasin
  • 3
  • 2

1 Answers1

3

Try this

fscanf(filename,"%d %d %[^\n]",array[i],array2[i],array3[i]);
BLUEPIXY
  • 39,049
  • 7
  • 31
  • 69
haccks
  • 100,941
  • 24
  • 163
  • 252