|
From: Maya <Esc...@ne...> - 2004-01-08 01:50:14
|
Ok I have managed to store data in a std::vector<...> object, but how
can I get the data from it?
Thanks folks!!
jme::error_t jme::Index::bagIt(){
// temporary stream
jme::gnu_io tmp_stream;
// temporary account object
jme::Account tmp_acc;
// set file name
tmp_stream.setFileName(fname);
// if the file stream does not exist return return error value
if(tmp_stream.notExist()){ return jme::fe_no_not_exist; }
//set file mode
tmp_stream.setMode(tmp_stream.read_bin);
// open file for reading
tmp_stream.Read();
// if the file is empty let the class know and return error value
if(tmp_stream.is_empty()){
bag_empty = false;
return jme::fe_empty;
}
// get the stream size
std::streampos fsz = tmp_stream.getFileSize();
do{
// Read a record into the jme::Account object
tmp_stream >> tmp_acc;
// add record to the container
bag.push_back(tmp_acc);
// do this while the maximum number of bits in the file are not
// reached
}while(fsz != tmp_stream.getNextRead());
// sort the container
std::make_heap(bag.begin(), bag.end());
std::sort_heap(bag.begin(), bag.end());
// Return jme::error_t::good
return jme::good;
}
--
FYI
http://www.astro.umd.edu/~marshall/abbrev.html
E-Mail Policy
http://www.vif.com/users/escalante/Email_Policy.html
* You cannot exercise your power to a point of humiliation.
- Jean Chretien
* The media's the most powerful entity on earth. They have the
power to make the innocent guilty and to make the guilty
innocent, and that's power.
- Malcom X
* "Innocent until proven guilty", no... not in Canada!!
|