What is the best way to read data from a file into a fixed size array of
unsigned char? This is a file holding only a SHA1 digest. What I would
really like to do is initialize the ifstream with the buffer allocated to
hold the data, seekg(ios_base::end) and magically have the data appear in
the buffer. I believe something close to this can be done.
I might allocate the array:
const unsigned LENGTH = 256;
unsigned char b[LENGTH];
Then cast it to a std::streambuf
std::streambuf sb(b[LENGTH]);
But can I construct std::ifstream that uses that same memory to hold the
data from its file? How to I prevent reading past the end of my buffer, or
the end of the file data?
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/