I don't think I explained myself properly.
This is what I am supposed to do.
The TextFieldLoader class will have only one constructor and MUST accept
the following parameters only:
1. filename (const char *) that will be used to read (and store) the entire
contents of the file into memory.
2. row (int), and
3. column (int) representing where on the screen the TextFieldLoader is
located.
4. width (int), and
5. height (int) representing the TextFieldLoader's dimensions.
Once instantiated, the TextFieldLoader must use the functions seekg( ) and
tellg( ) to dynamically determine how large the file is before loading
the contents of the file into memory using only one call to the read( )
function.
The base class TextFields constructor receives the filename as a variable
TextField(fn, row, col, width, height)
fn is the name of the file and also where variable should be stored.
This is what I got so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
TextFieldLoader::TextFieldLoader(/*const */char *fn, int row, int col, int width, int height)
: fstream(fn), TextField(fn, row, col, width, height){
int length;
//determining the size of the file
//move to end of file
seekg(ios::beg, ios::end);
//get length
length = tellg();
//move to start of file
seekg(/*0,*/ ios::beg);
//read into memory
read(*page_, length);
}
| |