Not sure what I'm doing wrong. I can't get the data to display on the console for menu option #2. I'm only getting the cout statement for "Reading contents backwards...." , but nothing else. Option #1 works ok. ANY IDEAS?
Terri Pinon 95 A
John Doe 80 B
Jack Johnson 75 C
Natalie Smith 90 A
Chris Shaw 70 C
Tim Thomas 100 A
Corey Jones 92 A
Anthony Hill 85 B
Jerry Culpepper 86 B
Bill Moon 73 C
Jen Lowell 70 C
Nick Brown 99 A
Timothy Bell 89 B
John Mallek 50 F
Clint Eastwood 68 D
Michelle Norris 84 B
Sally Fields 96 A
Jason Bourne 100 A
Melody Swift 83 B
Thomas Iban 70 C
I'm going another route here. I can't get this to work either. I'm getting the count ok in numBytes, but then can't read backwards from that position. Can someone please suggest a fix?
I experimented a little bit with this. I found certain sequences of operations result in the fail() flag being set. There are several solutions (and I don't know which is best). One is to clear the flags before the seekg().
> we haven't learned vectors in class yet, so I can't use them, unfortunately.
> we're focusing on seek/tell
In that case, you would want to seek to a position that was not returned by an earlier tellg().
You should open the file in binary mode and not text mode.