Hi guys.
I'm rying to read in from a text file. The text file is formatted like this:
author ;title ;category;number
(there are 28 lines)
How can i read this data into 4 user defines variables, using an array? i am using this code:
BookData a[MAX] ;
int Read = 0 ;
do
{
file.get(a[Read].author, 26) ;
file.get(a[Read].title, 32) ;
file.get(a[Read].category, 3) ;
file >> a[Read].booknumber ;
Read++ ;
}
while (file) ;
but the lines seem to skip, so for instance on the second line, it misses data, and starts reading 8 character is.
Can you pleasseeee help!
thanks.
I'm rying to read in from a text file. The text file is formatted like this:
author ;title ;category;number
(there are 28 lines)
How can i read this data into 4 user defines variables, using an array? i am using this code:
BookData a[MAX] ;
int Read = 0 ;
do
{
file.get(a[Read].author, 26) ;
file.get(a[Read].title, 32) ;
file.get(a[Read].category, 3) ;
file >> a[Read].booknumber ;
Read++ ;
}
while (file) ;
but the lines seem to skip, so for instance on the second line, it misses data, and starts reading 8 character is.
Can you pleasseeee help!
thanks.