I know this is probably a stupid question... but I've only just started with c++ this year and I'm working on a File I/0 summative. Anyway, this code is almost right out of the textbook and it's for a program that is supposed to keep track of cd's. How can I change this function so that it reads the cd with the title specified by the user instead of the cd number (RecNum)? The code in the textbook does not seem to be working.
bool ReadCD(fstream&F, const long RecNum, CDType&CD)
/*Reads record RecNum into CD
Pre: F is open for reading
Post: CD contains record RecNum
false returned if the read fails, otherwise true returned*/
if ((RecNum < NumRecords(F)) &&(F.seekg(RecNum*MaxRecSize)))
Hmm.. I think that code which is using CDROM isn't for newbies..
structs like cdtype or what you are using are too complicated for me :) (maybe I'm also a newbie..)
I think you could write some simple programs..
There is a lot of stuff about setting output form while using cout, I don't know it..