Reputation: 53
Actually I am trying to solve a problem using C file management where I have to read a text file where are some data given of multiple student. The problem is with their name. I thought I can solve that problem with first name and last name but then I figured out that some of name are multiple word more than two. So is their any way to solve that full name issue?
The text file is in txt format.
1. 1330273 Sajjad Kashem 1 0 1 0 0 1 1 1 0
2. 1520297 A. S. M. Irfan 0 0 0 1 1 0 1 1 1
Upvotes: 0
Views: 77
Reputation: 802
If the next character after name is 0 or 1, you could try this approach:
sscanf(line, "%d. %d %[^01]%d %d %d %d %d %d %d %d %d", &a, &b, name, &c, &d, &e, &f ...);
Don't forget to strip name
: last character can be space.
Upvotes: 2