file input - getline / deliminating character issues

while(getline(bookFile,books[count].title,';'))
{
bookFile>>books[count].year;
bookFile.ignore(1);
bookFile>>books[count].author;
bookFile.ignore(1);
bookFile>>books[count].price;

count++;
}

the code seems to just ignore the deliminating character and enter the whole first line into the title member of the books struct. I can not figure out why, any help would be appreciated .. thanks
Your input looks like this, right?

Island of the Blue Dolphins; 1960; Scott O'Dell; 6.99
The Trumpet of the Swan; 1970; E. B. White; 6.50


Don't forget to read the EOL character at the end of each record.
1
2
3
4
5
6
7
8
9
10
while (getline( bookFile, books[count].title, ';' ))
{
  bookFile >> books[count].year;
  bookFile.ignore( 1000, ';' );
  ...
  bookFile >> books[count].price;
  bookFile.ignore( 1000, '\n' );

  count++;
}

Hope this edit helps.
Last edited on
Topic archived. No new replies allowed.